]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
Minor fixes to MSSQL reflection
authorPaul Johnston <paj@pajhome.org.uk>
Mon, 3 Sep 2007 13:57:08 +0000 (13:57 +0000)
committerPaul Johnston <paj@pajhome.org.uk>
Mon, 3 Sep 2007 13:57:08 +0000 (13:57 +0000)
lib/sqlalchemy/databases/mssql.py

index 5f07ac29650253c339f09287ccee0753d115e881..3e8949e14f4019929e9ad163c5678394f1575ed7 100644 (file)
@@ -580,8 +580,8 @@ class MSSQLDialect(default.DefaultDialect):
                     warnings.warn(RuntimeWarning("Did not recognize type '%s' of column '%s'" % (type, name)))
                     coltype = sqltypes.NULLTYPE
                     
-                elif coltype == MSNVarchar and charlen == -1:
-                    charlen = None
+                elif coltype in (MSNVarchar, AdoMSNVarchar) and charlen == -1:
+                    args[0] = None
                 coltype = coltype(*args)
             colargs= []
             if default is not None:
@@ -593,7 +593,7 @@ class MSSQLDialect(default.DefaultDialect):
             raise exceptions.NoSuchTableError(table.name)
 
         # We also run an sp_columns to check for identity columns:
-        cursor = connection.execute("sp_columns " + self.identifier_preparer.format_table(table))
+        cursor = connection.execute("sp_columns [%s]" % self.identifier_preparer.format_table(table))
         ic = None
         while True:
             row = cursor.fetchone()