aboutsummaryrefslogtreecommitdiff
path: root/odb/pgsql/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
commite4b2a3484d7a640ff84803e0d9374c93063a151e (patch)
tree367314821b69717f2c96856163dd874cedd5a110 /odb/pgsql/transaction-impl.cxx
parentfef380f6c9a5fb9904d551478fe180a9c5d24b37 (diff)
Implement early connection release
Diffstat (limited to 'odb/pgsql/transaction-impl.cxx')
-rw-r--r--odb/pgsql/transaction-impl.cxx16
1 files changed, 16 insertions, 0 deletions
diff --git a/odb/pgsql/transaction-impl.cxx b/odb/pgsql/transaction-impl.cxx
index c6fe61a..7cc2bc2 100644
--- a/odb/pgsql/transaction-impl.cxx
+++ b/odb/pgsql/transaction-impl.cxx
@@ -62,6 +62,10 @@ namespace odb
void transaction_impl::
commit ()
{
+ // Invalidate query results.
+ //
+ connection_->invalidate_results ();
+
{
odb::tracer* t;
if ((t = connection_->tracer ()) || (t = database_.tracer ()))
@@ -72,11 +76,19 @@ namespace odb
if (!h || PGRES_COMMAND_OK != PQresultStatus (h))
translate_error (*connection_, h);
+
+ // Release the connection.
+ //
+ connection_.reset ();
}
void transaction_impl::
rollback ()
{
+ // Invalidate query results.
+ //
+ connection_->invalidate_results ();
+
{
odb::tracer* t;
if ((t = connection_->tracer ()) || (t = database_.tracer ()))
@@ -87,6 +99,10 @@ namespace odb
if (!h || PGRES_COMMAND_OK != PQresultStatus (h))
translate_error (*connection_, h);
+
+ // Release the connection.
+ //
+ connection_.reset ();
}
}
}