summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/connectors
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2011-02-09 15:06:32 -0500
committerMike Bayer <mike_mp@zzzcomputing.com>2011-02-09 15:06:32 -0500
commit6f16b8db6f08cefd68cdf251292316497eb849b3 (patch)
treedd86ad7eb16671bfec3ea091f2b0cfd5b6e18893 /lib/sqlalchemy/connectors
parentf473398f0170a00b0e760a7dba292087144c7e45 (diff)
downloadsqlalchemy-6f16b8db6f08cefd68cdf251292316497eb849b3.tar.gz
- add connection and cursor to is_disconnect(). We aren't using it yet,
but we'd like to. Most DBAPIs don't give us anything we can do with it. Some research was done on psycopg2 and it still seems like they give us no adequate method (tried connection.closed, cursor.closed, connection.status). mxodbc claims their .closed attribute will work (but I am skeptical). - remove beahvior in pool that auto-invalidated a connection when the cursor failed to create. That's not the pool's job. we need the conn for the error logic. Can't get any tests to fail, curious why that behavior was there, guess we'll find out (or not). - add support for psycopg2 version detection. even though we have no use for it yet... - adjust one of the reconnect tests to work with oracle's horrendously slow connect speed
Diffstat (limited to 'lib/sqlalchemy/connectors')
-rw-r--r--lib/sqlalchemy/connectors/mxodbc.py6
-rw-r--r--lib/sqlalchemy/connectors/pyodbc.py2
-rw-r--r--lib/sqlalchemy/connectors/zxJDBC.py2
3 files changed, 5 insertions, 5 deletions
diff --git a/lib/sqlalchemy/connectors/mxodbc.py b/lib/sqlalchemy/connectors/mxodbc.py
index f467234ca..5573dda40 100644
--- a/lib/sqlalchemy/connectors/mxodbc.py
+++ b/lib/sqlalchemy/connectors/mxodbc.py
@@ -106,9 +106,9 @@ class MxODBCConnector(Connector):
opts.pop('database', None)
return (args,), opts
- def is_disconnect(self, e):
- # eGenix recommends checking connection.closed here,
- # but how can we get a handle on the current connection?
+ def is_disconnect(self, e, connection, cursor):
+ # TODO: eGenix recommends checking connection.closed here
+ # Does that detect dropped connections ?
if isinstance(e, self.dbapi.ProgrammingError):
return "connection already closed" in str(e)
elif isinstance(e, self.dbapi.Error):
diff --git a/lib/sqlalchemy/connectors/pyodbc.py b/lib/sqlalchemy/connectors/pyodbc.py
index c66a8a8ae..3f6d6cb5f 100644
--- a/lib/sqlalchemy/connectors/pyodbc.py
+++ b/lib/sqlalchemy/connectors/pyodbc.py
@@ -81,7 +81,7 @@ class PyODBCConnector(Connector):
connectors.extend(['%s=%s' % (k,v) for k,v in keys.iteritems()])
return [[";".join (connectors)], connect_args]
- def is_disconnect(self, e):
+ def is_disconnect(self, e, connection, cursor):
if isinstance(e, self.dbapi.ProgrammingError):
return "The cursor's connection has been closed." in str(e) or \
'Attempt to use a closed connection.' in str(e)
diff --git a/lib/sqlalchemy/connectors/zxJDBC.py b/lib/sqlalchemy/connectors/zxJDBC.py
index a9ff5ec95..20bf9d9cf 100644
--- a/lib/sqlalchemy/connectors/zxJDBC.py
+++ b/lib/sqlalchemy/connectors/zxJDBC.py
@@ -46,7 +46,7 @@ class ZxJDBCConnector(Connector):
self.jdbc_driver_name],
opts]
- def is_disconnect(self, e):
+ def is_disconnect(self, e, connection, cursor):
if not isinstance(e, self.dbapi.ProgrammingError):
return False
e = str(e)