summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/interfaces.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2008-05-09 16:34:10 +0000
committerMike Bayer <mike_mp@zzzcomputing.com>2008-05-09 16:34:10 +0000
commit4a6afd469fad170868554bf28578849bf3dfd5dd (patch)
treeb396edc33d567ae19dd244e87137296450467725 /lib/sqlalchemy/interfaces.py
parent46b7c9dc57a38d5b9e44a4723dad2ad8ec57baca (diff)
downloadsqlalchemy-4a6afd469fad170868554bf28578849bf3dfd5dd.tar.gz
r4695 merged to trunk; trunk now becomes 0.5.
0.4 development continues at /sqlalchemy/branches/rel_0_4
Diffstat (limited to 'lib/sqlalchemy/interfaces.py')
-rw-r--r--lib/sqlalchemy/interfaces.py23
1 files changed, 22 insertions, 1 deletions
diff --git a/lib/sqlalchemy/interfaces.py b/lib/sqlalchemy/interfaces.py
index eaad25769..959989662 100644
--- a/lib/sqlalchemy/interfaces.py
+++ b/lib/sqlalchemy/interfaces.py
@@ -67,7 +67,7 @@ class PoolListener(object):
The ``_ConnectionFairy`` which manages the connection for the span of
the current checkout.
- If you raise an ``exceptions.DisconnectionError``, the current
+ If you raise an ``exc.DisconnectionError``, the current
connection will be disposed and a fresh connection retrieved.
Processing of all checkout listeners will abort and restart
using the new connection.
@@ -87,3 +87,24 @@ class PoolListener(object):
The ``_ConnectionRecord`` that persistently manages the connection
"""
+
+class ConnectionProxy(object):
+ """Allows interception of statement execution by Connections.
+
+ Subclass ``ConnectionProxy``, overriding either or both of
+ ``execute()`` and ``cursor_execute()`` The default behavior is provided,
+ which is to call the given executor function with the remaining
+ arguments. The proxy is then connected to an engine via
+ ``create_engine(url, proxy=MyProxy())`` where ``MyProxy`` is
+ the user-defined ``ConnectionProxy`` class.
+
+ """
+ def execute(self, conn, execute, clauseelement, *multiparams, **params):
+ """"""
+ return execute(clauseelement, *multiparams, **params)
+
+ def cursor_execute(self, execute, cursor, statement, parameters, context, executemany):
+ """"""
+ return execute(cursor, statement, parameters, context)
+
+