]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
Changes to get mysqlconnector passing most tests.
authorMichael Trier <mtrier@gmail.com>
Sun, 28 Feb 2010 23:56:11 +0000 (23:56 +0000)
committerMichael Trier <mtrier@gmail.com>
Sun, 28 Feb 2010 23:56:11 +0000 (23:56 +0000)
lib/sqlalchemy/dialects/mysql/base.py
lib/sqlalchemy/dialects/mysql/mysqlconnector.py
test/engine/test_execute.py
test/orm/test_naturalpks.py

index b9e3080b282a08b878703e83adc5203a4a4175e1..2311b06df10eb7a4542482b1f932c023e718d93a 100644 (file)
@@ -2504,7 +2504,11 @@ class _DecodingRowProxy(object):
         item = self.rowproxy[index]
         if isinstance(item, _array):
             item = item.tostring()
+        # Py2K
         if self.charset and isinstance(item, str):
+        # end Py2K
+        # Py3K
+        #if self.charset and isinstance(item, bytes):
             return item.decode(self.charset)
         else:
             return item
@@ -2513,7 +2517,11 @@ class _DecodingRowProxy(object):
         item = getattr(self.rowproxy, attr)
         if isinstance(item, _array):
             item = item.tostring()
+        # Py2K
         if self.charset and isinstance(item, str):
+        # end Py2K
+        # Py3K
+        #if self.charset and isinstance(item, bytes):
             return item.decode(self.charset)
         else:
             return item
index f715b72dffa68a84b09f6d5d14154a97c0991c2a..9e7caae5659c51d33f59ba43f54686cf33b763f4 100644 (file)
@@ -49,11 +49,10 @@ class _myconnpyBIT(BIT):
 
 class MySQL_mysqlconnector(MySQLDialect):
     driver = 'mysqlconnector'
-    supports_unicode_statements = False
+    supports_unicode_statements = True
     supports_unicode_binds = True
-    supports_sane_rowcount = False
+    supports_sane_rowcount = True
     supports_sane_multi_rowcount = True
-    description_encoding = None
 
     default_paramstyle = 'format'
     execution_ctx_cls = MySQL_mysqlconnectorExecutionContext
index 1752fda0ddc3d099431e36582b3590c177db10e2..4004ae93665f6318584b451b94fb8dfbf1f682db 100644 (file)
@@ -50,7 +50,7 @@ class ExecuteTest(TestBase):
                                         (7, 'sally')]
             conn.execute("delete from users")
 
-    @testing.fails_on_everything_except('mysql+mysqldb', 'postgresql')
+    @testing.fails_on_everything_except('mysql+mysqldb', 'mysql+mysqlconnector', 'postgresql')
     @testing.fails_on('postgresql+zxjdbc', 'sprintf not supported')
     # some psycopg2 versions bomb this.
     def test_raw_sprintf(self):
@@ -70,7 +70,7 @@ class ExecuteTest(TestBase):
     # pyformat is supported for mysql, but skipping because a few driver
     # versions have a bug that bombs out on this test. (1.2.2b3, 1.2.2c1, 1.2.2)
     @testing.skip_if(lambda: testing.against('mysql+mysqldb'), 'db-api flaky')
-    @testing.fails_on_everything_except('postgresql+psycopg2', 'postgresql+pypostgresql')
+    @testing.fails_on_everything_except('postgresql+psycopg2', 'postgresql+pypostgresql', 'mysql+mysqlconnector')
     def test_raw_python(self):
         for conn in (testing.db, testing.db.connect()):
             conn.execute("insert into users (user_id, user_name) values (%(id)s, %(name)s)",
index b061766bf3b151df0a25521397e0425f93b6edb6..70adb1a8bc0f822050c57f87aa815b4e48ee16a5 100644 (file)
@@ -594,7 +594,7 @@ class CascadeToFKPKTest(_base.MappedTest, testing.AssertsCompiledSQL):
         self._test_onetomany(True)
 
     # PG etc. need passive=True to allow PK->PK cascade
-    @testing.fails_on_everything_except('sqlite')
+    @testing.fails_on_everything_except('sqlite', 'mysql+mysqlconnector')
     def test_onetomany_nonpassive(self):
         self._test_onetomany(False)
         
@@ -737,7 +737,7 @@ class JoinedInheritanceTest(_base.MappedTest):
         self._test_pk(True)
 
     # PG etc. need passive=True to allow PK->PK cascade
-    @testing.fails_on_everything_except('sqlite')
+    @testing.fails_on_everything_except('sqlite', 'mysql+mysqlconnector')
     def test_pk_nonpassive(self):
         self._test_pk(False)
         
@@ -747,7 +747,7 @@ class JoinedInheritanceTest(_base.MappedTest):
         self._test_fk(True)
         
     # PG etc. need passive=True to allow PK->PK cascade
-    @testing.fails_on_everything_except('sqlite')
+    @testing.fails_on_everything_except('sqlite', 'mysql+mysqlconnector')
     def test_fk_nonpassive(self):
         self._test_fk(False)
 
@@ -803,4 +803,4 @@ class JoinedInheritanceTest(_base.MappedTest):
     
     
     
-    
\ No newline at end of file
+