]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
- a better fix for [ticket:810]. The cause was two phase commit/rollback not opening...
authorAnts Aasma <ants.aasma@gmail.com>
Mon, 8 Oct 2007 16:11:08 +0000 (16:11 +0000)
committerAnts Aasma <ants.aasma@gmail.com>
Mon, 8 Oct 2007 16:11:08 +0000 (16:11 +0000)
CHANGES
lib/sqlalchemy/databases/postgres.py

diff --git a/CHANGES b/CHANGES
index bad34bd22aa7656149af4b75c0fd49cee67090ee..2723504ef9b188f1e3deca0661255289fb9780d9 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -48,8 +48,9 @@ CHANGES
 
 - Firebird now uses dialect.preparer to format sequences names
 
-- Fixed breakage with postgres and multiple two phase transactions. For some
-  reason the implicitly started transaction is not enough. [ticket:810]
+- Fixed breakage with postgres and multiple two-phase transactions. Two-phase
+  commits and and rollbacks didn't automatically end up with a new transaction
+  as the usual dbapi commits/rollbacks do. [ticket:810]
 
 - Added an option to the _ScopedExt mapper extension to not automatically
   save new objects to session on object initialization.
index 345893524c2ae09f09a5502ff5b8b4d210d36062..5d6773789ae442ea6201db0706e15ec089a1dc70 100644 (file)
@@ -306,9 +306,6 @@ class PGDialect(default.DefaultDialect):
         return sqltypes.adapt_type(typeobj, colspecs)
 
     def do_begin_twophase(self, connection, xid):
-        # Two phase transactions seem to require that the transaction is explicitly started.
-        # The implicit transactions that usually work aren't enough.
-        connection.execute(sql.text("BEGIN"))
         self.do_begin(connection.connection)
 
     def do_prepare_twophase(self, connection, xid):
@@ -321,6 +318,7 @@ class PGDialect(default.DefaultDialect):
                 # Must find out a way how to make the dbapi not open a transaction.
                 connection.execute(sql.text("ROLLBACK"))
             connection.execute(sql.text("ROLLBACK PREPARED %(tid)s", bindparams=[sql.bindparam('tid', xid)]))
+            connection.execute(sql.text("BEGIN"))
         else:
             self.do_rollback(connection.connection)
 
@@ -329,6 +327,7 @@ class PGDialect(default.DefaultDialect):
             if recover:
                 connection.execute(sql.text("ROLLBACK"))
             connection.execute(sql.text("COMMIT PREPARED %(tid)s", bindparams=[sql.bindparam('tid', xid)]))
+            connection.execute(sql.text("BEGIN"))
         else:
             self.do_commit(connection.connection)