From 9fce9a7250f63a2a3cceeb0aac7b22d5dd7e6915 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Tue, 30 Aug 2011 16:10:02 +0200 Subject: 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. --- odb/pgsql/connection.hxx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'odb/pgsql/connection.hxx') 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 #include #include +#include #include // PGconn #include @@ -84,8 +85,11 @@ namespace odb private: database_type& db_; - PGconn* handle_; + auto_handle handle_; + // Keep statement_cache_ after handle_ so that it is destroyed before + // the connection is closed. + // std::auto_ptr statement_cache_; }; } -- cgit v1.1