From 9cccdfb0fdd54e4a254842e0f68cd41a33912776 Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Fri, 19 Dec 2008 23:02:45 +0000 Subject: removed the "create_execution_context()" method from dialects and replaced with a more succinct "dialect.execution_ctx_cls" member --- lib/sqlalchemy/engine/base.py | 12 +++--------- lib/sqlalchemy/engine/default.py | 5 ++--- 2 files changed, 5 insertions(+), 12 deletions(-) (limited to 'lib/sqlalchemy/engine') diff --git a/lib/sqlalchemy/engine/base.py b/lib/sqlalchemy/engine/base.py index dbcd5b76b..9efd73a89 100644 --- a/lib/sqlalchemy/engine/base.py +++ b/lib/sqlalchemy/engine/base.py @@ -177,11 +177,6 @@ class Dialect(object): raise NotImplementedError() - def create_execution_context(self, connection, compiled=None, compiled_parameters=None, statement=None, parameters=None): - """Return a new :class:`~sqlalchemy.engine.ExecutionContext` object.""" - - raise NotImplementedError() - def do_begin(self, connection): """Provide an implementation of *connection.begin()*, given a DB-API connection.""" @@ -314,9 +309,7 @@ class ExecutionContext(object): a list of Column objects for which a server-side default or inline SQL expression value was fired off. applies to inserts and updates. - The Dialect should provide an ExecutionContext via the - create_execution_context() method. The `pre_exec` and `post_exec` - methods will be called for compiled statements. + """ def create_cursor(self): @@ -927,7 +920,8 @@ class Connection(Connectable): def __create_execution_context(self, **kwargs): try: - return self.engine.dialect.create_execution_context(connection=self, **kwargs) + dialect = self.engine.dialect + return dialect.execution_ctx_cls(dialect, connection=self, **kwargs) except Exception, e: self._handle_dbapi_exception(e, kwargs.get('statement', None), kwargs.get('parameters', None), None) raise diff --git a/lib/sqlalchemy/engine/default.py b/lib/sqlalchemy/engine/default.py index 251cf8b2c..11fd43df5 100644 --- a/lib/sqlalchemy/engine/default.py +++ b/lib/sqlalchemy/engine/default.py @@ -59,9 +59,6 @@ class DefaultDialect(base.Dialect): raise exc.ArgumentError("Label length of %d is greater than this dialect's maximum identifier length of %d" % (label_length, self.max_identifier_length)) self.label_length = label_length - def create_execution_context(self, connection, **kwargs): - return DefaultExecutionContext(self, connection, **kwargs) - def type_descriptor(self, typeobj): """Provide a database-specific ``TypeEngine`` object, given the generic object which comes from the types module. @@ -367,3 +364,5 @@ class DefaultExecutionContext(base.ExecutionContext): self.postfetch_cols = self.compiled.postfetch self.prefetch_cols = self.compiled.prefetch + +DefaultDialect.execution_ctx_cls = DefaultExecutionContext \ No newline at end of file -- cgit v1.2.1