Commits

Mike Bayer committed 80ed73f Draft

Added a py3K conditional around unnecessary .decode()
call in mssql information schema, fixes reflection
in Py3K. [ticket:2638]

Comments (0)

Files changed (3)

doc/build/changelog/changelog_07.rst

       logic's failure to take .key into account.
 
     .. change::
+        :tags: mssql, bug
+        :tickets: 2638
+
+      Added a Py3K conditional around unnecessary .decode()
+      call in mssql information schema, fixes reflection
+      in Py3k.
+
+    .. change::
         :tags: orm, bug
         :tickets: 2650
 

lib/sqlalchemy/dialects/mssql/information_schema.py

     impl = Unicode
 
     def process_bind_param(self, value, dialect):
+        # Py2K
         if isinstance(value, str):
             value = value.decode(dialect.encoding)
+        # end Py2K
         return value
 
 schemata = Table("SCHEMATA", ischema,

test/dialect/test_mssql.py

         fp.close()
         return stream
 
+class InfoCoerceUnicodeTest(fixtures.TestBase):
+    def test_info_unicode_coercion(self):
+        from sqlalchemy.dialects.mssql.information_schema import CoerceUnicode
+
+        dialect = mssql.dialect()
+        value = CoerceUnicode().bind_processor(dialect)('a string')
+        assert isinstance(value, unicode)
 
 class ReflectHugeViewTest(fixtures.TestBase):
     __only_on__ = 'mssql'