summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2010-07-12 11:15:16 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2010-07-12 11:15:16 -0400
commit800448ad621a7cbe50726b6e208f55264dc623bc (patch)
tree56a0504e0c14c157e493e0ade28cccf052e542ce /lib
parent8f0ac7b5c968fac2cccd4f5bb7dcca927aff5f0b (diff)
downloadsqlalchemy-800448ad621a7cbe50726b6e208f55264dc623bc.tar.gz
- 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]
Diffstat (limited to 'lib')
-rw-r--r--lib/sqlalchemy/dialects/mysql/mysqldb.py4
-rw-r--r--lib/sqlalchemy/test/engines.py5
2 files changed, 8 insertions, 1 deletions
diff --git a/lib/sqlalchemy/dialects/mysql/mysqldb.py b/lib/sqlalchemy/dialects/mysql/mysqldb.py
index 6e6bb0ecc..d43b62ce3 100644
--- a/lib/sqlalchemy/dialects/mysql/mysqldb.py
+++ b/lib/sqlalchemy/dialects/mysql/mysqldb.py
@@ -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):
diff --git a/lib/sqlalchemy/test/engines.py b/lib/sqlalchemy/test/engines.py
index 0cfd58d20..9e77f38d7 100644
--- a/lib/sqlalchemy/test/engines.py
+++ b/lib/sqlalchemy/test/engines.py
@@ -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 = []