]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
- The _extract_error_code() method now works
authorMike Bayer <mike_mp@zzzcomputing.com>
Mon, 12 Jul 2010 15:15:16 +0000 (11:15 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Mon, 12 Jul 2010 15:15:16 +0000 (11:15 -0400)
correctly with the "mysqldb" dialect.  Previously,
the reconnect logic would fail for OperationalError
conditions, however since MySQLdb has its
own reconnect feature, there was no symptom
here unless one watched the logs.
[ticket:1848]

CHANGES
lib/sqlalchemy/dialects/mysql/mysqldb.py
lib/sqlalchemy/test/engines.py

diff --git a/CHANGES b/CHANGES
index 83ed69118b6bedce1688773a40c2f7faa79abd7d..082ec838227e8b038acac529ad214896bcca3f25 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -25,6 +25,16 @@ CHANGES
     naming/typing information about the entities
     the Query will return.  Can be helpful for 
     building GUIs on top of ORM queries.
+
+- mysql
+
+  - The _extract_error_code() method now works 
+    correctly with the "mysqldb" dialect.  Previously,
+    the reconnect logic would fail for OperationalError
+    conditions, however since MySQLdb has its
+    own reconnect feature, there was no symptom 
+    here unless one watched the logs.  
+    [ticket:1848]
     
 0.6.2
 =====
index 6e6bb0ecc6706323e71d51911621973f4debe40e..d43b62ce3d2bc565fd964d42d008d67dea562b04 100644 (file)
@@ -157,8 +157,10 @@ class MySQLDialect_mysqldb(MySQLDialect):
 
     def _extract_error_code(self, exception):
         try:
-            return exception.orig.args[0]
+            return exception.args[0]
         except AttributeError:
+            # this AttributeError is likely unnecessary,
+            # but would need to confirm against MySQLdb code
             return None
 
     def _detect_charset(self, connection):
index 0cfd58d20704ba413d2bc1e5f269127c4f0a667d..9e77f38d718d29a4fcbba737d31766b72a5ecba7 100644 (file)
@@ -105,6 +105,11 @@ class ReconnectFixture(object):
         return conn
 
     def shutdown(self):
+        # TODO: this doesn't cover all cases
+        # as nicely as we'd like, namely MySQLdb.
+        # would need to implement R. Brewer's
+        # proxy server idea to get better
+        # coverage.
         for c in list(self.connections):
             c.close()
         self.connections = []