built from it.
- mssql
+ - Added in new types: MSVarBinary and MSImage. [ticket:1249]
- Added in the MSReal and MSNText types.
- bugfixes, behavioral changes
new doc section "Custom Comparators".
- mssql
+ - ``MSBinary`` now returns a ``BINARY`` instead of an
+ ``IMAGE``. This is a backwards incompatible change in that
+ ``BINARY`` is a fixed length data type whereas ``IMAGE`` is
+ a variable length data type. [ticket:1249]
+
- ``get_default_schema_name`` is now reflected from the
database based on the user's default schema. This only works
with MSSQL 2005 and later. [ticket:1258]
class MSBinary(sqltypes.Binary):
+ def get_col_spec(self):
+ if self.length:
+ return "BINARY(%s)" % self.length
+ else:
+ return "BINARY"
+
+
+class MSVarBinary(MSBinary):
+ def get_col_spec(self):
+ if self.length:
+ return "VARBINARY(%s)" % self.length
+ else:
+ return "VARBINARY"
+
+
+class MSImage(MSBinary):
def get_col_spec(self):
return "IMAGE"
+
class MSBoolean(sqltypes.Boolean):
def get_col_spec(self):
return "BIT"
'date': MSDate,
'smalldatetime' : MSSmallDate,
'binary' : MSBinary,
- 'varbinary' : MSBinary,
+ 'varbinary' : MSVarBinary,
'bit': MSBoolean,
'real' : MSFloat,
- 'image' : MSBinary,
+ 'image' : MSImage,
'timestamp': MSTimeStamp,
'money': MSMoney,
'smallmoney': MSSmallMoney,
columns = [
# column type, args, kwargs, expected ddl
(mssql.MSBinary, [], {},
+ 'BINARY'),
+ (mssql.MSBinary, [10], {},
+ 'BINARY(10)'),
+
+ (mssql.MSVarBinary, [], {},
+ 'VARBINARY'),
+ (mssql.MSVarBinary, [10], {},
+ 'VARBINARY(10)'),
+
+ (mssql.MSImage, [], {},
'IMAGE')
]
assert True
except:
raise
+
+ reflected_binary = Table('test_mssql_binary', MetaData(testing.db), autoload=True)
+ for col in reflected_binary.c:
+ testing.eq_(col.type.__class__, binary_table.c[col.name].type.__class__)
+ if binary_table.c[col.name].type.length:
+ testing.eq_(col.type.length, binary_table.c[col.name].type.length)
binary_table.drop()
def test_boolean(self):
'VARCHAR'),
(mssql.MSString, [1], {},
'VARCHAR(1)'),
- (mssql.MSString, ['max'], {},
- 'VARCHAR(max)'),
(mssql.MSString, [1], {'collation': 'Latin1_General_CI_AS'},
'VARCHAR(1) COLLATE Latin1_General_CI_AS'),
'NVARCHAR'),
(mssql.MSNVarchar, [1], {},
'NVARCHAR(1)'),
- (mssql.MSNVarchar, ['max'], {},
- 'NVARCHAR(max)'),
(mssql.MSNVarchar, [1], {'collation': 'Latin1_General_CI_AS'},
'NVARCHAR(1) COLLATE Latin1_General_CI_AS'),