]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
Removed MxNumeric and MxFloat because now the sqlalchemy.types base classes support...
authorBrad Allen <bradallen137@gmail.com>
Thu, 18 Mar 2010 20:05:59 +0000 (14:05 -0600)
committerBrad Allen <bradallen137@gmail.com>
Thu, 18 Mar 2010 20:05:59 +0000 (14:05 -0600)
lib/sqlalchemy/connectors/mxodbc.py
lib/sqlalchemy/dialects/mssql/mxodbc.py

index 059931de6df464b9c80faa2a20e5f23d44bbcc85..484c11d4994efae3a2e0fe87c3f388526c7b2aac 100644 (file)
@@ -113,56 +113,3 @@ class MxODBCConnector(Connector):
         return tuple(version)
 
 
-class MxNumeric(sqltypes.Numeric):
-    """
-    Handle Numeric types between SQLAlchemy and mxODBC.
-    """
-    def bind_processor(self, dialect):
-        """
-        SQLAlchemy can accept a Python Decimal for bind
-        variables, so no special bind_processor is needed.
-        """
-        return None
-
-    def result_processor(self, dialect, coltype):
-        """
-        By default, the SQLAlchemy mxODBC connector is
-        configured to return Decimal values from 
-        Numeric columns. In addition, the SQLAlchemy's
-        Numeric type is expected to return a Python Numeric,
-        so by default no action is needed.
-        
-        However, if the user specifies asdecimal=False
-        on a Decimal column, it is expected to return
-        a Python float.
-        """
-        if self.asdecimal:
-            return None
-        else:
-            return processors.to_float
-
-
-class MxFloat(sqltypes.Float):
-    """
-    Handle Numeric types between SQLAlchemy and mxODBC.
-    """
-    def bind_processor(self, dialect):
-        """
-        SQLAlchemy can accept a Python Decimal for bind
-        variables, so no special bind_processor is needed.
-        """
-        return None
-
-    def result_processor(self, dialect, coltype):
-        """
-        mxODBC returns Python float values for REAL, FLOAT, and
-        DOUBLE column types, so if the user specifies 'asdecimal',
-        SQLAlchemy needs to coerce the value to a Decimal type.
-        Otherwise, no special action is needed.
-        """
-        if self.asdecimal:
-            return processors.to_decimal_processor_factory(Decimal)
-        else:
-            return None
-
-        
index 2ff2f39f744b759966ac88481f749aa4e57eeeb1..30d14bf3814184495f124433dd6fdedcb9703973 100644 (file)
@@ -3,10 +3,11 @@ import sys
 
 from sqlalchemy import types as sqltypes
 from sqlalchemy import util
-from sqlalchemy.connectors.mxodbc import MxODBCConnector, MxNumeric, MxFloat
+from sqlalchemy.connectors.mxodbc import MxODBCConnector
 from sqlalchemy.dialects.mssql.pyodbc import MSExecutionContext_pyodbc
-from sqlalchemy.dialects.mssql.base import MSExecutionContext, MSDialect, \
-                                            MSSQLCompiler, MSSQLStrictCompiler
+from sqlalchemy.dialects.mssql.base import (MSExecutionContext, MSDialect, 
+                                            MSSQLCompiler, MSSQLStrictCompiler,
+                                            _MSDateTime, _MSDate, TIME)
 
         
 class MSExecutionContext_mxodbc(MSExecutionContext_pyodbc):
@@ -24,17 +25,14 @@ class MSDialect_mxodbc(MxODBCConnector, MSDialect):
     # TODO: may want to use this only if FreeTDS is not in use,
     # since FreeTDS doesn't seem to use native binds.
     statement_compiler = MSSQLStrictCompiler
-
     execution_ctx_cls = MSExecutionContext_mxodbc
-    colspecs = util.update_copy(
-        MSDialect.colspecs,
-        {
-        sqltypes.Numeric : MxNumeric,
-        sqltypes.Float : MxFloat
-        },
-    )
+    colspecs = {
+        #sqltypes.Numeric : _MSNumeric,
+        sqltypes.DateTime : _MSDateTime,
+        sqltypes.Date : _MSDate,
+        sqltypes.Time : TIME,
+    }
 
-    
 
     def __init__(self, description_encoding='latin-1', **params):
         super(MSDialect_mxodbc, self).__init__(**params)