summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/databases/mssql.py
diff options
context:
space:
mode:
authorMichael Trier <mtrier@gmail.com>2009-01-03 20:07:17 +0000
committerMichael Trier <mtrier@gmail.com>2009-01-03 20:07:17 +0000
commit770f603afb09f9586810e6a73351d13d1f73f585 (patch)
tree5ef5d692df7c5e83c048fc92d288829bc652098a /lib/sqlalchemy/databases/mssql.py
parent9b89103394fb90f92763f66de7624ff8bbbe0a58 (diff)
downloadsqlalchemy-770f603afb09f9586810e6a73351d13d1f73f585.tar.gz
Corrected an issue on mssql where Numerics would not accept an int.
Diffstat (limited to 'lib/sqlalchemy/databases/mssql.py')
-rw-r--r--lib/sqlalchemy/databases/mssql.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/sqlalchemy/databases/mssql.py b/lib/sqlalchemy/databases/mssql.py
index 0904d7b90..e14732745 100644
--- a/lib/sqlalchemy/databases/mssql.py
+++ b/lib/sqlalchemy/databases/mssql.py
@@ -220,7 +220,7 @@ Known Issues
does **not** work around
"""
-import datetime, inspect, operator, re, sys, urllib
+import datetime, decimal, inspect, operator, re, sys, urllib
from sqlalchemy import sql, schema, exc, util
from sqlalchemy.sql import compiler, expression, operators as sqlops, functions as sql_functions
@@ -313,7 +313,9 @@ class MSNumeric(sqltypes.Numeric):
# Not sure that this exception is needed
return value
else:
- if not isinstance(value, float) and value._exp < -6:
+ # FIXME: this will not correct a situation where a float
+ # gets converted to e-notation.
+ if isinstance(value, decimal.Decimal) and value._exp < -6:
value = ((value < 0 and '-' or '')
+ '0.'
+ '0' * -(value._exp+1)