[ticket:1090]
+ - add SLFloat type, which matches the SQLite REAL
+ type affinity. Previously, only SLNumeric was provided
+ which fulfills NUMERIC affinity, but that's not the
+ same as REAL.
0.4.6
=====
else:
return "NUMERIC(%(precision)s, %(length)s)" % {'precision': self.precision, 'length' : self.length}
+class SLFloat(sqltypes.Float):
+ def bind_processor(self, dialect):
+ type_ = self.asdecimal and str or float
+ def process(value):
+ if value is not None:
+ return type_(value)
+ else:
+ return value
+ return process
+
+ def get_col_spec(self):
+ return "FLOAT"
+
class SLInteger(sqltypes.Integer):
def get_col_spec(self):
return "INTEGER"
sqltypes.CHAR: SLChar,
sqltypes.Date: SLDate,
sqltypes.DateTime: SLDateTime,
- sqltypes.Float: SLNumeric,
+ sqltypes.Float: SLFloat,
sqltypes.Integer: SLInteger,
sqltypes.NCHAR: SLChar,
sqltypes.Numeric: SLNumeric,
}
db = testing.db
- if testing.against('sqlite', 'oracle'):
+ if testing.against('oracle'):
expectedResults['float_column'] = 'float_column NUMERIC(25, 2)'
+ if testing.against('sqlite'):
+ expectedResults['float_column'] = 'float_column FLOAT'
+
if testing.against('maxdb'):
expectedResults['numeric_column'] = (
expectedResults['numeric_column'].replace('NUMERIC', 'FIXED'))