]> 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:36 +0000 (17:15 +0000)
committerMike Bayer <mike_mp@zzzcomputing.com>
Wed, 4 Nov 2009 17:15:36 +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 9e6d45a0af3ddb981d0f57b3d1589418809e6078..57b79ea15998ef08ed0aa9c629aef0a006830b9c 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -681,6 +681,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 33a30201fcc03ebd3b6a7d59848e62bfa50e4d49..b65843f48d771131a01e8ebd12e2948161699de2 100644 (file)
@@ -1204,7 +1204,6 @@ class Transaction(object):
         This is used to cancel a Transaction without affecting the scope of
         an enclosing transaction.
         """
-
         if not self._parent.is_active:
             return
         if self._parent is self:
@@ -1278,7 +1277,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)
 
 
index 11dd0e0102fd4eacd4d840d17a7c629f60cc7dbe..82b767b0eb79d0f9d8cf79f83005c100cc758cf5 100644 (file)
@@ -226,6 +226,7 @@ class TransactionTest(TestBase):
         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')
@@ -235,7 +236,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,)]