aboutsummaryrefslogtreecommitdiff
path: root/odb/pgsql/connection.hxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2011-08-30 16:10:02 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2011-08-30 16:10:30 +0200
commit9fce9a7250f63a2a3cceeb0aac7b22d5dd7e6915 (patch)
treedd20f89ddd286f663aaf881835970c03cc628855 /odb/pgsql/connection.hxx
parent44a26d189e186ac10c4a80c4dbb68d65927b12a9 (diff)
Implement uniform handle management across all databases
Also use the auto_handle template instead of the raw handle in connection, statement, and result classes. This removes a lot of brittle "exception safety guarantee" code that we had in those classes.
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_;
};
}