From 3f64781802deb7f910a37e3998cfc358b65e24e9 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/mysql/connection.hxx | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'odb/mysql/connection.hxx') diff --git a/odb/mysql/connection.hxx b/odb/mysql/connection.hxx index f4462ed..3667c10 100644 --- a/odb/mysql/connection.hxx +++ b/odb/mysql/connection.hxx @@ -18,6 +18,7 @@ #include #include #include +#include #include @@ -124,7 +125,7 @@ namespace odb alloc_stmt_handle (); void - free_stmt_handle (MYSQL_STMT*); + free_stmt_handle (auto_handle&); private: connection (const connection&); @@ -142,11 +143,18 @@ namespace odb bool failed_; MYSQL mysql_; - MYSQL* handle_; + auto_handle handle_; statement* active_; + + // Keep statement_cache_ after handle_ so that it is destroyed before + // the connection is closed. + // std::auto_ptr statement_cache_; + // List of "delayed" statement handles to be freed next time there + // is no active statement. + // typedef std::vector stmt_handles; stmt_handles stmt_handles_; }; -- cgit v1.1