From 2e39895e727689e88608fd909d4ec77c28ca4ff0 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Wed, 15 Sep 2010 09:54:48 +0200 Subject: Reset active statement in statements' ctors --- odb/mysql/statement.cxx | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'odb/mysql/statement.cxx') diff --git a/odb/mysql/statement.cxx b/odb/mysql/statement.cxx index 3e0deb8..f5379d6 100644 --- a/odb/mysql/statement.cxx +++ b/odb/mysql/statement.cxx @@ -69,6 +69,9 @@ namespace odb image_version_ (0), parameters_ (parameters) { + if (statement* a = conn_.active ()) + a->cancel (); + if (mysql_stmt_prepare (stmt_, s.c_str (), s.size ()) != 0) throw database_exception (stmt_); } @@ -210,6 +213,9 @@ namespace odb persist_statement (connection& conn, const string& s, binding& image) : statement (conn), image_ (image), version_ (0) { + if (statement* a = conn_.active ()) + a->cancel (); + if (mysql_stmt_prepare (stmt_, s.c_str (), s.size ()) != 0) throw database_exception (stmt_); } @@ -280,6 +286,9 @@ namespace odb image_ (image), image_version_ (0) { + if (statement* a = conn_.active ()) + a->cancel (); + if (mysql_stmt_prepare (stmt_, s.c_str (), s.size ()) != 0) throw database_exception (stmt_); } @@ -398,6 +407,9 @@ namespace odb image_ (image), image_version_ (0) { + if (statement* a = conn_.active ()) + a->cancel (); + if (mysql_stmt_prepare (stmt_, s.c_str (), s.size ()) != 0) throw database_exception (stmt_); } @@ -456,6 +468,9 @@ namespace odb erase_statement (connection& conn, const string& s, binding& id) : statement (conn), id_ (id), version_ (0) { + if (statement* a = conn_.active ()) + a->cancel (); + if (mysql_stmt_prepare (stmt_, s.c_str (), s.size ()) != 0) throw database_exception (stmt_); } -- cgit v1.1