From 61178c5d6d23f3643c54bfb87b42773691c8a0b7 Mon Sep 17 00:00:00 2001 From: Michael Trier Date: Fri, 14 Nov 2008 03:57:04 +0000 Subject: [PATCH] Fixed a problem with the casting of a zero length type to a varchar. It now correctly adjusts the CAST accordingly. --- CHANGES | 3 +++ lib/sqlalchemy/databases/mssql.py | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) 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): -- 2.47.3