diff options
Diffstat (limited to 'odb/mysql/connection.cxx')
-rw-r--r-- | odb/mysql/connection.cxx | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/odb/mysql/connection.cxx b/odb/mysql/connection.cxx index f8e88a0..e8c9903 100644 --- a/odb/mysql/connection.cxx +++ b/odb/mysql/connection.cxx @@ -26,8 +26,7 @@ namespace odb db_ (db), failed_ (false), handle_ (&mysql_), - active_ (0), - statement_cache_ (new statement_cache_type (*this)) + active_ (0) { if (mysql_init (handle_) == 0) throw bad_alloc (); @@ -64,6 +63,19 @@ namespace odb throw database_exception (e, sqlstate, message); } + + statement_cache_.reset (new statement_cache_type (*this)); + } + + connection:: + connection (database_type& db, MYSQL* handle) + : odb::connection (db), + db_ (db), + failed_ (false), + handle_ (handle), + active_ (0) + { + statement_cache_.reset (new statement_cache_type (*this)); } connection:: |