]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
scan for autocommit based on text() specific flag, saves isinstance() call on each...
authorMike Bayer <mike_mp@zzzcomputing.com>
Tue, 10 Nov 2009 22:59:59 +0000 (22:59 +0000)
committerMike Bayer <mike_mp@zzzcomputing.com>
Tue, 10 Nov 2009 22:59:59 +0000 (22:59 +0000)
lib/sqlalchemy/engine/default.py
lib/sqlalchemy/sql/expression.py

index a7f6dc4faeef17e7a355c6988795c4b3e699b5c7..ca5106c3411c7e5ae039a9a765cfff7118c9768f 100644 (file)
@@ -256,8 +256,8 @@ class DefaultExecutionContext(base.ExecutionContext):
             self.isupdate = compiled.isupdate
             self.isdelete = compiled.isdelete
             self.should_autocommit = compiled.statement._autocommit
-            if isinstance(compiled.statement, expression._TextClause):
-                self.should_autocommit = self.should_autocommit or self.should_autocommit_text(self.statement)
+            if self.should_autocommit is expression.PARSE_AUTOCOMMIT:
+                self.should_autocommit = self.should_autocommit_text(self.statement)
 
             if not parameters:
                 self.compiled_parameters = [compiled.construct_params()]
index 5e4978bfb05342fbe2d34f612a5cbd501fcfa634..a7cba8161bd6c826fa5b512e75606cf9a5e224b3 100644 (file)
@@ -49,7 +49,7 @@ __all__ = [
     'literal_column', 'not_', 'null', 'or_', 'outparam', 'outerjoin', 'select',
     'subquery', 'table', 'text', 'union', 'union_all', 'update', ]
 
-
+PARSE_AUTOCOMMIT = util._symbol('PARSE_AUTOCOMMIT')
 
 def desc(column):
     """Return a descending ``ORDER BY`` clause element.
@@ -2189,7 +2189,7 @@ class _TextClause(ClauseElement):
     _hide_froms = []
 
     def __init__(self, text = "", bind=None, 
-                    bindparams=None, typemap=None, autocommit=False):
+                    bindparams=None, typemap=None, autocommit=PARSE_AUTOCOMMIT):
         self._bind = bind
         self.bindparams = {}
         self.typemap = typemap