aboutsummaryrefslogtreecommitdiff
path: root/odb/pgsql/connection.hxx
diff options
context:
space:
mode:
Diffstat (limited to 'odb/pgsql/connection.hxx')
-rw-r--r--odb/pgsql/connection.hxx6
1 files changed, 5 insertions, 1 deletions
diff --git a/odb/pgsql/connection.hxx b/odb/pgsql/connection.hxx
index 063f8d4..fd74c6e 100644
--- a/odb/pgsql/connection.hxx
+++ b/odb/pgsql/connection.hxx
@@ -19,6 +19,7 @@
#include <odb/pgsql/version.hxx>
#include <odb/pgsql/forward.hxx>
#include <odb/pgsql/transaction-impl.hxx>
+#include <odb/pgsql/auto-handle.hxx>
#include <odb/pgsql/pgsql-fwd.hxx> // PGconn
#include <odb/pgsql/details/export.hxx>
@@ -84,8 +85,11 @@ namespace odb
private:
database_type& db_;
- PGconn* handle_;
+ auto_handle<PGconn> handle_;
+ // Keep statement_cache_ after handle_ so that it is destroyed before
+ // the connection is closed.
+ //
std::auto_ptr<statement_cache_type> statement_cache_;
};
}