]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
- MySQL error 2014 "commands out of sync" appears to be raised as a
authorMike Bayer <mike_mp@zzzcomputing.com>
Fri, 27 Jun 2014 19:52:40 +0000 (15:52 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Fri, 27 Jun 2014 19:52:40 +0000 (15:52 -0400)
ProgrammingError, not OperationalError, in modern MySQL-Python versions;
all MySQL error codes that are tested for "is disconnect" are now
checked within OperationalError and ProgrammingError regardless.
fixes #3101

doc/build/changelog/changelog_08.rst
lib/sqlalchemy/dialects/mysql/base.py

index 7c232eb794fbf5fe6a5f5b31076876fc2a79aa51..f4044d39024bc9e2ff9f224e45a70b2af76b9251 100644 (file)
 .. changelog::
     :version: 0.8.7
 
+    .. change::
+        :tags: bug, mysql
+        :versions: 1.0.0, 0.9.5
+        :tickets: 3101
+
+        MySQL error 2014 "commands out of sync" appears to be raised as a
+        ProgrammingError, not OperationalError, in modern MySQL-Python versions;
+        all MySQL error codes that are tested for "is disconnect" are now
+        checked within OperationalError and ProgrammingError regardless.
+
     .. change::
         :tags: bug, mysql
         :versions: 1.0.0, 0.9.5
index 6d8b6a07c87a1ee6cae79d523d8a80785cc1b8f1..77fb34fd8e4a5fa76ee4a7c729c3cdb784ff24e2 100644 (file)
@@ -2225,7 +2225,7 @@ class MySQLDialect(default.DefaultDialect):
         return [row['data'][0:row['gtrid_length']] for row in resultset]
 
     def is_disconnect(self, e, connection, cursor):
-        if isinstance(e, self.dbapi.OperationalError):
+        if isinstance(e, (self.dbapi.OperationalError, self.dbapi.ProgrammingError)):
             return self._extract_error_code(e) in \
                         (2006, 2013, 2014, 2045, 2055)
         elif isinstance(e, self.dbapi.InterfaceError):