summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/engine/base.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2014-03-19 13:03:44 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2014-03-19 13:03:44 -0400
commit2a1a79b6ce53f2e1dc4cd48bbca5c5a148b8b285 (patch)
tree40acfcb869ba3747e531c172627d2bccd13d18f4 /lib/sqlalchemy/engine/base.py
parent89a8e0d187b8967c9b8291bcdc3078335704dbfa (diff)
downloadsqlalchemy-2a1a79b6ce53f2e1dc4cd48bbca5c5a148b8b285.tar.gz
- The :meth:`.ConnectionEvents.after_cursor_execute` event is now
emitted for the "_cursor_execute()" method of :class:`.Connection`; this is the "quick" executor that is used for things like when a sequence is executed ahead of an INSERT statement, as well as for dialect startup checks like unicode returns, charset, etc. the :meth:`.ConnectionEvents.before_cursor_execute` event was already invoked here. The "executemany" flag is now always set to False here, as this event always corresponds to a single execution. Previously the flag could be True if we were acting on behalf of an executemany INSERT statement.
Diffstat (limited to 'lib/sqlalchemy/engine/base.py')
-rw-r--r--lib/sqlalchemy/engine/base.py15
1 files changed, 11 insertions, 4 deletions
diff --git a/lib/sqlalchemy/engine/base.py b/lib/sqlalchemy/engine/base.py
index 888a15fee..d3024640b 100644
--- a/lib/sqlalchemy/engine/base.py
+++ b/lib/sqlalchemy/engine/base.py
@@ -986,8 +986,7 @@ class Connection(Connectable):
statement, parameters = \
fn(self, cursor, statement, parameters,
context,
- context.executemany
- if context is not None else False)
+ False)
if self._echo:
self.engine.logger.info(statement)
@@ -996,14 +995,22 @@ class Connection(Connectable):
self.dialect.do_execute(
cursor,
statement,
- parameters)
+ parameters,
+ context)
except Exception as e:
self._handle_dbapi_exception(
e,
statement,
parameters,
cursor,
- None)
+ context)
+
+ if self._has_events:
+ self.dispatch.after_cursor_execute(self, cursor,
+ statement,
+ parameters,
+ context,
+ False)
def _safe_close_cursor(self, cursor):
"""Close the given cursor, catching exceptions