Commits

adamv committed ca62daa

Using "decimal" instead of "numeric" for the SQL Server column type (for DecimalField).

In SQL Server these field types are identical behind the scenes, and it will help my sanity to use "decimal" instead. Either field type will still be introspected correctly.

Comments (0)

Files changed (3)

source/sqlserver_ado/ado_consts.py

+# ADO enumerated constants documented on MSDN:
+# http://msdn.microsoft.com/en-us/library/ms678353(VS.85).aspx
+
 # IsolationLevelEnum
+adXactUnspecified     = -1
 adXactBrowse          = 0x100
 adXactChaos           = 0x10
 adXactCursorStability = 0x1000
 adXactRepeatableRead  = 0x10000
 adXactSerializable    = 0x100000
 
-
 # CursorLocationEnum
 adUseClient = 3
 adUseServer = 2
 
-
 # CommandTypeEnum
 adCmdText = 1
 adCmdStoredProc = 4
 
-
 # ParameterDirectionEnum
 adParamInput       = 1
 adParamInputOutput = 3
 adParamReturnValue = 4
 adParamUnknown     = 0
 
-
 # ObjectStateEnum
-adStateClosed     = 0 # Indicates that the object is closed. 
-adStateOpen       = 1 # Indicates that the object is open. 
-adStateConnecting = 2 # Indicates that the object is connecting. 
-adStateExecuting  = 4 # Indicates that the object is executing a command. 
-adStateFetching   = 8 # Indicates that the rows of the object are being retrieved.
-
+adStateClosed     = 0
+adStateOpen       = 1
+adStateConnecting = 2
+adStateExecuting  = 4
+adStateFetching   = 8
 
 # FieldAttributeEnum
 adFldMayBeNull = 0x40
 
-
 # ConnectModeEnum
+# To-do: Add the other adMode consts or remove this definition
 adModeShareExclusive = 12
 
-
 # XactAttributeEnum
 adXactCommitRetaining = 131072
 adXactAbortRetaining = 262144
 
-
 ado_error_TIMEOUT = -2147217871
 
-
-# ADO Data types documented at:
+# DataTypeEnum - ADO Data types documented at:
 # http://msdn2.microsoft.com/en-us/library/ms675318.aspx
-
-# DataTypeEnum
 adArray                       = 0x2000
 adEmpty                       = 0x0
 adBSTR                        = 0x8

source/sqlserver_ado/creation.py

         'CommaSeparatedIntegerField': 'nvarchar(%(max_length)s)',
         'DateField':         'datetime',
         'DateTimeField':     'datetime',
-        'DecimalField':      'numeric(%(max_digits)s, %(decimal_places)s)',
+        'DecimalField':      'decimal(%(max_digits)s, %(decimal_places)s)',
         'FileField':         'nvarchar(%(max_length)s)',
         'FilePathField':     'nvarchar(%(max_length)s)',
         'FloatField':        'double precision',

source/sqlserver_ado/dbapi.py

 License along with this library; if not, write to the Free Software
 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
-Version 2.1 by Vernon Cole
-Version 2.1D by Adam Vandenberg (forked for internal Django backend use)
+* Version 2.1 by Vernon Cole
+* Version 2.1D by Adam Vandenberg (forked for internal Django backend use)
+  Note that this file acts as a db-api 2 interface for ADO, but is rather 
+  SQL Server and Django specific now, and probaby won't work against other 
+  ADO backends anymore.
 """
 
 import sys
     int: adInteger,
     long: adBigInt,
     bool: adBoolean,
-    decimal.Decimal: adNumeric,
+    decimal.Decimal: adDecimal,
     datetime.date: adDate,
     datetime.datetime: adDate,
     datetime.time: adDate, }
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.