diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2007-06-09 20:59:59 +0000 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2007-06-09 20:59:59 +0000 |
commit | 86c9ffeea6e47a1793287703384d8b0f605a6569 (patch) | |
tree | 865754da449d7b802d1a246ce9086255d1a7756e | |
parent | 4302d162ae608ab975f6dfc34350c4883bc18747 (diff) | |
download | sqlalchemy-86c9ffeea6e47a1793287703384d8b0f605a6569.tar.gz |
added StaticPool, stores just one connection.
-rw-r--r-- | lib/sqlalchemy/pool.py | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/lib/sqlalchemy/pool.py b/lib/sqlalchemy/pool.py index 8915b8098..a77e979ab 100644 --- a/lib/sqlalchemy/pool.py +++ b/lib/sqlalchemy/pool.py @@ -536,6 +536,31 @@ class NullPool(Pool): def do_get(self): return self.create_connection() +class StaticPool(Pool): + """A Pool implementation which stores exactly one connection that is + returned for all requests.""" + + def __init__(self, creator, **params): + Pool.__init__(self, creator, **params) + self._conn = creator() + self.connection = _ConnectionRecord(self) + + def status(self): + return "StaticPool" + + def create_connection(self): + return self._conn + + def do_return_conn(self, conn): + pass + + def do_return_invalid(self, conn): + pass + + def do_get(self): + return self.connection + + class AssertionPool(Pool): """A Pool implementation that allows at most one checked out connection at a time. |