]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
- Fixed bug in two-phase transaction whereby commit() method
authorMike Bayer <mike_mp@zzzcomputing.com>
Wed, 4 Nov 2009 17:15:52 +0000 (17:15 +0000)
committerMike Bayer <mike_mp@zzzcomputing.com>
Wed, 4 Nov 2009 17:15:52 +0000 (17:15 +0000)
didn't set the full state which allows subsequent close()
call to succeed. [ticket:1603]

CHANGES
lib/sqlalchemy/engine/base.py
test/engine/test_transaction.py

diff --git a/CHANGES b/CHANGES
index 09375c42db4bb2eb28643c5cc417bb0ff73771e7..c7738ec42144c3a7672e6fc5d675faa3ed7138ce 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -38,6 +38,10 @@ CHANGES
       appeared in the columns list. [ticket:1602]
       
 - sql
+    - Fixed bug in two-phase transaction whereby commit() method
+      didn't set the full state which allows subsequent close()
+      call to succeed. [ticket:1603]
+
     - Fixed the "numeric" paramstyle, which apparently is the
       default paramstyle used by Informixdb.
       
index 39085c359617067c8eef4ae953e37389a1d0728d..69b8303f66e274132507036910c37b433646990b 100644 (file)
@@ -1086,7 +1086,7 @@ class TwoPhaseTransaction(Transaction):
     def _do_rollback(self):
         self.connection._rollback_twophase_impl(self.xid, self._is_prepared)
 
-    def commit(self):
+    def _do_commit(self):
         self.connection._commit_twophase_impl(self.xid, self._is_prepared)
 
 class Engine(Connectable):
index 6698259a45d52d2d9bb5e10bf52b6ee58a2609e2..d1480a1810e01713ee28477c0b71f243af262c41 100644 (file)
@@ -219,10 +219,12 @@ class TransactionTest(TestBase):
         connection.execute(users.insert(), user_id=1, user_name='user1')
         transaction.prepare()
         transaction.commit()
+        transaction.close()
 
         transaction = connection.begin_twophase()
         connection.execute(users.insert(), user_id=2, user_name='user2')
         transaction.commit()
+        transaction.close()
 
         transaction = connection.begin_twophase()
         connection.execute(users.insert(), user_id=3, user_name='user3')
@@ -232,7 +234,8 @@ class TransactionTest(TestBase):
         connection.execute(users.insert(), user_id=4, user_name='user4')
         transaction.prepare()
         transaction.rollback()
-
+        transaction.close()
+        
         eq_(
             connection.execute(select([users.c.user_id]).order_by(users.c.user_id)).fetchall(),
             [(1,),(2,)]