aboutsummaryrefslogtreecommitdiff
path: root/odb/mysql/connection.hxx
diff options
context:
space:
mode:
Diffstat (limited to 'odb/mysql/connection.hxx')
-rw-r--r--odb/mysql/connection.hxx12
1 files changed, 10 insertions, 2 deletions
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 <odb/mysql/version.hxx>
#include <odb/mysql/forward.hxx>
#include <odb/mysql/transaction-impl.hxx>
+#include <odb/mysql/auto-handle.hxx>
#include <odb/details/shared-ptr.hxx>
@@ -124,7 +125,7 @@ namespace odb
alloc_stmt_handle ();
void
- free_stmt_handle (MYSQL_STMT*);
+ free_stmt_handle (auto_handle<MYSQL_STMT>&);
private:
connection (const connection&);
@@ -142,11 +143,18 @@ namespace odb
bool failed_;
MYSQL mysql_;
- MYSQL* handle_;
+ auto_handle<MYSQL> handle_;
statement* active_;
+
+ // Keep statement_cache_ after handle_ so that it is destroyed before
+ // the connection is closed.
+ //
std::auto_ptr<statement_cache_type> statement_cache_;
+ // List of "delayed" statement handles to be freed next time there
+ // is no active statement.
+ //
typedef std::vector<MYSQL_STMT*> stmt_handles;
stmt_handles stmt_handles_;
};