diff options
| author | Mike Bayer <mike_mp@zzzcomputing.com> | 2007-12-19 19:51:46 +0000 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2007-12-19 19:51:46 +0000 |
| commit | b9b0aca7575e347dfd62221c9d515decee4c75f6 (patch) | |
| tree | 2b2723368ef80367c6884016ae9a1486d6107d4c /lib/sqlalchemy/pool.py | |
| parent | e7f30cba786beeb788913b4be88c6c46d73c910d (diff) | |
| download | sqlalchemy-b9b0aca7575e347dfd62221c9d515decee4c75f6.tar.gz | |
- auto-reconnect support improved; a Connection can now automatically
reconnect after its underlying connection is invalidated, without
needing to connect() again from the engine. This allows an ORM session
bound to a single Connection to not need a reconnect.
Open transactions on the Connection must be rolled back after an invalidation
of the underlying connection else an error is raised. Also fixed
bug where disconnect detect was not being called for cursor(), rollback(),
or commit().
Diffstat (limited to 'lib/sqlalchemy/pool.py')
| -rw-r--r-- | lib/sqlalchemy/pool.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/sqlalchemy/pool.py b/lib/sqlalchemy/pool.py index ff38f21b8..7a5c2ef0e 100644 --- a/lib/sqlalchemy/pool.py +++ b/lib/sqlalchemy/pool.py @@ -208,7 +208,12 @@ class _ConnectionRecord(object): if self.connection is not None: if self.__pool._should_log_info: self.__pool.log("Closing connection %s" % repr(self.connection)) - self.connection.close() + try: + self.connection.close() + except: + if self.__pool._should_log_info: + self.__pool.log("Exception closing connection %s" % repr(self.connection)) + def invalidate(self, e=None): if self.__pool._should_log_info: |
