1. Victor Olex
  2. sqlalchemy

Commits

Mike Bayer  committed fb1052e

removed unnecessary _branch calls

  • Participants
  • Parent commits 0c1be65
  • Branches default

Comments (0)

Files changed (2)

File lib/sqlalchemy/engine/base.py

View file
         This is used to execute "sub" statements within a single execution,
         usually an INSERT statement.
         """
-
         return Connection(self.__engine, self.__connection, _branch=True)
 
     engine = property(lambda s:s.__engine, doc="The Engine with which this Connection is associated.")
 
     def __init__(self, context):
         self.context = context
-        self.connection = self.context._connection._branch()
-    dialect = property(lambda self:self.context.dialect)
+        self.connection = context._connection._branch()
+        self.dialect = context.dialect
 
     def get_column_default(self, column):
         if column.default is not None:

File lib/sqlalchemy/engine/default.py

View file
         self._connection = connection
         self.compiled = compiled
         self._postfetch_cols = util.Set()
+        self.engine = connection.engine
         
         if compiled is not None:
             self.typemap = compiled.typemap
             self.column_labels = compiled.column_labels
             self.statement = unicode(compiled)
+            self.isinsert = compiled.isinsert
+            self.isupdate = compiled.isupdate
             if parameters is None:
                 self.compiled_parameters = compiled.construct_params({})
                 self.executemany = False
                     self.executemany = False
                 else:
                     self.executemany = True
+
         elif statement is not None:
             self.typemap = self.column_labels = None
             self.parameters = self.__encode_param_keys(parameters)
             self.statement = statement
+            self.isinsert = self.isupdate = False
         else:
             self.statement = None
+            self.isinsert = self.isupdate = False
             
         if self.statement is not None and not dialect.supports_unicode_statements:
             self.statement = self.statement.encode(self.dialect.encoding)
             
         self.cursor = self.create_cursor()
     
-    engine = property(lambda s:s.connection.engine)
-    isinsert = property(lambda s:s.compiled and s.compiled.isinsert)
-    isupdate = property(lambda s:s.compiled and s.compiled.isupdate)
-    
     connection = property(lambda s:s._connection._branch())
     
     root_connection = property(lambda s:s._connection)