]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
- this pymssql test needs to be against the pymssql dialect
authorMike Bayer <mike_mp@zzzcomputing.com>
Thu, 18 Apr 2013 21:41:30 +0000 (17:41 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Thu, 18 Apr 2013 21:41:30 +0000 (17:41 -0400)
- Part of a longer series of fixes needed for pyodbc+
      mssql, a CAST to NVARCHAR(max) has been added to the bound
      parameter for the table name and schema name in all information schema
      queries to avoid the issue of comparing NVARCHAR to NTEXT,
      which seems to be rejected by the ODBC driver in some cases,
      such as FreeTDS (0.91 only?) plus unicode bound parameters being passed.
      The issue seems to be specific to the SQL Server information
      schema tables and the workaround is harmless for those cases
      where the problem doesn't exist in the first place.
[ticket:2355]

doc/build/changelog/changelog_08.rst
lib/sqlalchemy/dialects/mssql/information_schema.py
test/dialect/test_mssql.py

index 224690cc2934392eb7ee9188da873523141919e1..25a8d4c1909fd09942a43d0468118389216d3835 100644 (file)
@@ -6,6 +6,20 @@
 .. changelog::
     :version: 0.8.1
 
+    .. change::
+      :tags: bug, mssql
+      :tickets: 2355
+
+      Part of a longer series of fixes needed for pyodbc+
+      mssql, a CAST to NVARCHAR(max) has been added to the bound
+      parameter for the table name and schema name in all information schema
+      queries to avoid the issue of comparing NVARCHAR to NTEXT,
+      which seems to be rejected by the ODBC driver in some cases,
+      such as FreeTDS (0.91 only?) plus unicode bound parameters being passed.
+      The issue seems to be specific to the SQL Server information
+      schema tables and the workaround is harmless for those cases
+      where the problem doesn't exist in the first place.
+
     .. change::
       :tags: bug, sql
       :tickets: 2691
index 35ce2450e0da9cce795d6bc1ecf612994f588136..80e59d323e6fe16dc880e75a5118099b69a2cebd 100644 (file)
@@ -8,6 +8,7 @@
 
 from ... import Table, MetaData, Column
 from ...types import String, Unicode, Integer, TypeDecorator
+from ... import cast
 
 ischema = MetaData()
 
@@ -22,6 +23,9 @@ class CoerceUnicode(TypeDecorator):
         # end Py2K
         return value
 
+    def bind_expression(self, bindvalue):
+        return cast(bindvalue, Unicode)
+
 schemata = Table("SCHEMATA", ischema,
     Column("CATALOG_NAME", CoerceUnicode, key="catalog_name"),
     Column("SCHEMA_NAME", CoerceUnicode, key="schema_name"),
index 0dfda9015ce2da47dd3766b38b62754f2e59d38a..f1cd3fe85b830b6897ab2e4654965468bc661446 100644 (file)
@@ -1949,7 +1949,7 @@ class TypeRoundTripTest(fixtures.TestBase, AssertsExecutionResults, ComparesTabl
                 engine.execute(tbl.delete())
 
 class MonkeyPatchedBinaryTest(fixtures.TestBase):
-    __only_on__ = 'mssql'
+    __only_on__ = 'mssql+pymssql'
 
     def test_unicode(self):
         module = __import__('pymssql')