From e4b2a3484d7a640ff84803e0d9374c93063a151e Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Mon, 15 Oct 2012 13:17:30 +0200 Subject: Implement early connection release --- odb/pgsql/transaction-impl.cxx | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'odb/pgsql/transaction-impl.cxx') 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 (); } } } -- cgit v1.1