]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
fixed nasty transaction counting bug with new session thing + unit test
authorMike Bayer <mike_mp@zzzcomputing.com>
Fri, 17 Mar 2006 02:51:08 +0000 (02:51 +0000)
committerMike Bayer <mike_mp@zzzcomputing.com>
Fri, 17 Mar 2006 02:51:08 +0000 (02:51 +0000)
lib/sqlalchemy/engine.py
test/proxy_engine.py

index aa0449628d258e4ef235e95d526e20b6a6dfaade..482aa4270ea6ff3eada43538d41701418abddda1 100644 (file)
@@ -198,6 +198,7 @@ class SQLSession(object):
         """commits the transaction started by begin().  If begin() was called multiple times, a counter will be decreased for each call to commit(), with the actual commit operation occuring when the counter reaches zero.  this is to provide "nested" behavior of transactions so that different functions in a particular call stack can call begin()/commit() independently of each other without knowledge of an existing transaction."""
         if self.__tcount == 1:
             self.engine.do_commit(self.connection)
+            self.__tcount = 0
         elif self.__tcount > 1:
             self.__tcount -= 1
     def is_begun(self):
@@ -711,6 +712,11 @@ class SQLEngine(schema.SchemaEngine):
         return parameters
 
     def proxy(self, statement=None, parameters=None):
+        """returns a callable which will execute the given statement string and parameter object.
+        the parameter object is expected to be the result of a call to compiled.get_params().
+        This callable is a generic version of a connection/cursor-specific callable that
+        is produced within the execute_compiled method, and is used for objects that require
+        this style of proxy when outside of an execute_compiled method, primarily the DefaultRunner."""
         parameters = self._convert_compiled_params(parameters)
         return self.execute(statement, parameters)
     
index 14cd1902bc7cca00a0d7205a152d109ce74e473f..170e526d96d7af107209f4f69a69fa51410422c9 100644 (file)
@@ -11,7 +11,7 @@ import os
 #
 
 
-module_engine = ProxyEngine()
+module_engine = ProxyEngine(echo=testbase.echo)
 users = Table('users', module_engine, 
               Column('user_id', Integer, primary_key=True),
               Column('user_name', String(16)),