diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2010-08-10 13:57:24 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2010-08-10 13:57:24 +0200 |
commit | b49d3e5e0e58e69b4fde856e37f73d101b5b2c0a (patch) | |
tree | 92c587949496e21028071ab7ca2202bc5b67f6bb /odb/mysql/statement.cxx | |
parent | 0a589394a09ce5b3f16d902d657710a2886cc2fc (diff) |
Delay closing statement until there are no active statements
Diffstat (limited to 'odb/mysql/statement.cxx')
-rw-r--r-- | odb/mysql/statement.cxx | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/odb/mysql/statement.cxx b/odb/mysql/statement.cxx index 981c756..009e3f1 100644 --- a/odb/mysql/statement.cxx +++ b/odb/mysql/statement.cxx @@ -5,8 +5,6 @@ #include <mysql/mysqld_error.h> // ER_DUP_ENTRY -#include <new> // std::bad_alloc - #include <odb/mysql/statement.hxx> #include <odb/mysql/connection.hxx> #include <odb/mysql/exceptions.hxx> @@ -22,18 +20,15 @@ namespace odb statement:: statement (connection& conn) - : conn_ (conn) + : conn_ (conn), stmt_ (conn_.alloc_stmt_handle ()) { - stmt_ = mysql_stmt_init (conn_.handle ()); - if (stmt_ == 0) - throw bad_alloc (); } statement:: ~statement () { - mysql_stmt_close (stmt_); + conn_.free_stmt_handle (stmt_); } void statement:: |