aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2010-09-15 09:54:48 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2010-09-15 09:54:48 +0200
commit2e39895e727689e88608fd909d4ec77c28ca4ff0 (patch)
treebad7aa1a0181ff30ff762436edd27f70030ce4e0
parent7dd972a678cb9c91714125506f4bccf74bbe6ab6 (diff)
Reset active statement in statements' ctors
-rw-r--r--odb/mysql/statement.cxx15
1 files changed, 15 insertions, 0 deletions
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_);
}