aboutsummaryrefslogtreecommitdiff
path: root/odb/mysql/transaction-impl.cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2012-10-15 13:17:30 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2012-10-15 13:17:30 +0200
commitc3a2b62f33e1f3fe19700257efdba7123b272cc4 (patch)
tree281f2275a2a7202c24bf114532adcd5752eaf19d /odb/mysql/transaction-impl.cxx
parent9126281b53722115b2e8624632f2dd616f0c26a0 (diff)
Implement early connection release
Diffstat (limited to 'odb/mysql/transaction-impl.cxx')
-rw-r--r--odb/mysql/transaction-impl.cxx20
1 files changed, 18 insertions, 2 deletions
diff --git a/odb/mysql/transaction-impl.cxx b/odb/mysql/transaction-impl.cxx
index 02b3581..75b9c9a 100644
--- a/odb/mysql/transaction-impl.cxx
+++ b/odb/mysql/transaction-impl.cxx
@@ -55,6 +55,14 @@ namespace odb
void transaction_impl::
commit ()
{
+ // Invalidate query results.
+ //
+ connection_->invalidate_results ();
+
+ // Cancel and clear the active statement if any. This normally
+ // should happen automatically, however, if an exception is
+ // thrown, this may not be the case.
+ //
connection_->clear ();
{
@@ -68,12 +76,20 @@ namespace odb
// Release the connection.
//
- //connection_.reset ();
+ connection_.reset ();
}
void transaction_impl::
rollback ()
{
+ // Invalidate query results.
+ //
+ connection_->invalidate_results ();
+
+ // Cancel and clear the active statement if any. This normally
+ // should happen automatically, however, if an exception is
+ // thrown, this may not be the case.
+ //
connection_->clear ();
{
@@ -87,7 +103,7 @@ namespace odb
// Release the connection.
//
- //connection_.reset ();
+ connection_.reset ();
}
}
}