From: Michael Trier Date: Fri, 14 Nov 2008 03:57:04 +0000 (+0000) Subject: Fixed a problem with the casting of a zero length type to a varchar. It now correctly... X-Git-Tag: rel_0_5rc4~3 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=61178c5d6d23f3643c54bfb87b42773691c8a0b7;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git Fixed a problem with the casting of a zero length type to a varchar. It now correctly adjusts the CAST accordingly. --- diff --git a/CHANGES b/CHANGES index 58859fb402..e4e384b956 100644 --- a/CHANGES +++ b/CHANGES @@ -73,6 +73,9 @@ CHANGES schemas, particularly when those schemas are the default schema. [ticket:1217] + - Corrected problem with casting a zero length item to + a varchar. It now correctly adjusts the CAST. + - ext - Can now use a custom "inherit_condition" in __mapper_args__ when using declarative. diff --git a/lib/sqlalchemy/databases/mssql.py b/lib/sqlalchemy/databases/mssql.py index e23ed4104b..f9d8b8f1f9 100644 --- a/lib/sqlalchemy/databases/mssql.py +++ b/lib/sqlalchemy/databases/mssql.py @@ -212,7 +212,7 @@ class MSText(sqltypes.Text): class MSString(sqltypes.String): def get_col_spec(self): - return "VARCHAR(%(length)s)" % {'length' : self.length} + return "VARCHAR" + (self.length and "(%d)" % self.length or "") class MSNVarchar(sqltypes.Unicode): def get_col_spec(self):