summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2009-11-04 17:15:36 +0000
committerMike Bayer <mike_mp@zzzcomputing.com>2009-11-04 17:15:36 +0000
commita69a094db57ab1c6220930274a96457b0c353221 (patch)
tree72ff0f5c788ddd15d38df5f60db25b9baf538302
parent43348d6163959217c6b6d4d0818e3a261a359285 (diff)
downloadsqlalchemy-a69a094db57ab1c6220930274a96457b0c353221.tar.gz
- Fixed bug in two-phase transaction whereby commit() method
didn't set the full state which allows subsequent close() call to succeed. [ticket:1603]
-rw-r--r--CHANGES4
-rw-r--r--lib/sqlalchemy/engine/base.py3
-rw-r--r--test/engine/test_transaction.py4
3 files changed, 8 insertions, 3 deletions
diff --git a/CHANGES b/CHANGES
index 9e6d45a0a..57b79ea15 100644
--- 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.
diff --git a/lib/sqlalchemy/engine/base.py b/lib/sqlalchemy/engine/base.py
index 33a30201f..b65843f48 100644
--- a/lib/sqlalchemy/engine/base.py
+++ b/lib/sqlalchemy/engine/base.py
@@ -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)
diff --git a/test/engine/test_transaction.py b/test/engine/test_transaction.py
index 11dd0e010..82b767b0e 100644
--- a/test/engine/test_transaction.py
+++ b/test/engine/test_transaction.py
@@ -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,)]