diff options
Diffstat (limited to 'lib/sqlalchemy/connectors')
| -rw-r--r-- | lib/sqlalchemy/connectors/pyodbc.py | 43 |
1 files changed, 0 insertions, 43 deletions
diff --git a/lib/sqlalchemy/connectors/pyodbc.py b/lib/sqlalchemy/connectors/pyodbc.py index 5cf00bc92..b291f3e16 100644 --- a/lib/sqlalchemy/connectors/pyodbc.py +++ b/lib/sqlalchemy/connectors/pyodbc.py @@ -5,49 +5,6 @@ import sys import re import urllib import decimal -from sqlalchemy import processors, types as sqltypes - -class PyODBCNumeric(sqltypes.Numeric): - """Turns Decimals with adjusted() < -6 into floats, > 7 into strings""" - - convert_large_decimals_to_string = False - - def bind_processor(self, dialect): - super_process = super(PyODBCNumeric, self).bind_processor(dialect) - - def process(value): - if self.asdecimal and \ - isinstance(value, decimal.Decimal): - - if value.adjusted() < -6: - return processors.to_float(value) - elif self.convert_large_decimals_to_string and \ - value.adjusted() > 7: - return self._large_dec_to_string(value) - - if super_process: - return super_process(value) - else: - return value - return process - - def _large_dec_to_string(self, value): - if 'E' in str(value): - result = "%s%s%s" % ( - (value < 0 and '-' or ''), - "".join([str(s) for s in value._int]), - "0" * (value.adjusted() - (len(value._int)-1))) - else: - if (len(value._int) - 1) > value.adjusted(): - result = "%s%s.%s" % ( - (value < 0 and '-' or ''), - "".join([str(s) for s in value._int][0:value.adjusted() + 1]), - "".join([str(s) for s in value._int][value.adjusted() + 1:])) - else: - result = "%s%s" % ( - (value < 0 and '-' or ''), - "".join([str(s) for s in value._int][0:value.adjusted() + 1])) - return result class PyODBCConnector(Connector): driver='pyodbc' |
