aboutsummaryrefslogtreecommitdiff
path: root/odb/mysql/statement.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'odb/mysql/statement.cxx')
-rw-r--r--odb/mysql/statement.cxx9
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::