Mike Bayer avatar Mike Bayer committed 4d6f85d Merge

Merged in bentrofatter/sqlalchemy-2663 (pull request #49)

Fixed PyMySQL problems for Python 2.x and mitigated some issues with Python 3.x

Comments (0)

Files changed (3)

lib/sqlalchemy/dialects/mysql/base.py

         cursor.execute('SELECT @@tx_isolation')
         val = cursor.fetchone()[0]
         cursor.close()
+        # Py3K
+        #if isinstance(val, bytes):
+        #    val = val.decode()
+        # Py2K
+        # end Py2K
         return val.upper().replace("-", " ")
 
     def do_commit(self, dbapi_connection):

lib/sqlalchemy/dialects/mysql/pymysql.py

     driver = 'pymysql'
 
     description_encoding = None
+    # Py3K
+    #supports_unicode_statements = True
+    # Py2K
+    # end Py2K
 
     @classmethod
     def dbapi(cls):
         return __import__('pymysql')
 
+    # Py3K
+    #def _extract_error_code(self, exception):
+    #    if isinstance(exception.args[0], Exception):
+    #        exception = exception.args[0]
+    #    return exception.args[0]
+    # Py2K
+    # end Py2K
+
 dialect = MySQLDialect_pymysql

test/sql/test_types.py

                 # end Py2K
             )
 
+        elif testing.against('mysql+pymysql'):
+            eq_(
+                testing.db.dialect.returns_unicode_strings,
+                # Py3K
+                #True
+                # Py2K
+                False
+                # end Py2K
+            )
+
         else:
             expected = (testing.db.name, testing.db.driver) in \
                 (
                     ('mysql', 'oursql'),
                     ('mysql', 'zxjdbc'),
                     ('mysql', 'mysqlconnector'),
-                    ('mysql', 'pymysql'),
                     ('sqlite', 'pysqlite'),
                     ('oracle', 'zxjdbc'),
                     ('oracle', 'cx_oracle'),
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.