aboutsummaryrefslogtreecommitdiff
path: root/odb/mysql/statement.cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2011-02-21 12:47:58 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2011-02-21 12:47:58 +0200
commit9155251867692cb212c26fd5380abc0815c2f44b (patch)
treee3c342a806f2164e8c50ee39d619ae36a9a4dfdc /odb/mysql/statement.cxx
parent495ec10e4c1880e1d6cce5526a4d6a43a48bfa94 (diff)
Factor out active statement cancelling into separate function
Diffstat (limited to 'odb/mysql/statement.cxx')
-rw-r--r--odb/mysql/statement.cxx24
1 files changed, 8 insertions, 16 deletions
diff --git a/odb/mysql/statement.cxx b/odb/mysql/statement.cxx
index 7ab9c04..b311dbe 100644
--- a/odb/mysql/statement.cxx
+++ b/odb/mysql/statement.cxx
@@ -68,8 +68,7 @@ namespace odb
data_ (data),
data_version_ (0)
{
- if (statement* a = conn_.active ())
- a->cancel ();
+ conn_.clear ();
if (mysql_stmt_prepare (stmt_, s.c_str (), s.size ()) != 0)
translate_error (conn_, stmt_);
@@ -78,8 +77,7 @@ namespace odb
void select_statement::
execute ()
{
- if (statement* a = conn_.active ())
- a->cancel ();
+ conn_.clear ();
if (cached_)
free_result ();
@@ -230,8 +228,7 @@ namespace odb
insert_statement (connection& conn, const string& s, binding& data)
: statement (conn), data_ (data), data_version_ (0)
{
- if (statement* a = conn_.active ())
- a->cancel ();
+ conn_.clear ();
if (mysql_stmt_prepare (stmt_, s.c_str (), s.size ()) != 0)
translate_error (conn_, stmt_);
@@ -240,8 +237,7 @@ namespace odb
bool insert_statement::
execute ()
{
- if (statement* a = conn_.active ())
- a->cancel ();
+ conn_.clear ();
if (mysql_stmt_reset (stmt_))
translate_error (conn_, stmt_);
@@ -284,8 +280,7 @@ namespace odb
image_ (image),
image_version_ (0)
{
- if (statement* a = conn_.active ())
- a->cancel ();
+ conn_.clear ();
if (mysql_stmt_prepare (stmt_, s.c_str (), s.size ()) != 0)
translate_error (conn_, stmt_);
@@ -294,8 +289,7 @@ namespace odb
void update_statement::
execute ()
{
- if (statement* a = conn_.active ())
- a->cancel ();
+ conn_.clear ();
if (mysql_stmt_reset (stmt_))
translate_error (conn_, stmt_);
@@ -338,8 +332,7 @@ namespace odb
delete_statement (connection& conn, const string& s, binding& cond)
: statement (conn), cond_ (cond), cond_version_ (0)
{
- if (statement* a = conn_.active ())
- a->cancel ();
+ conn_.clear ();
if (mysql_stmt_prepare (stmt_, s.c_str (), s.size ()) != 0)
translate_error (conn_, stmt_);
@@ -348,8 +341,7 @@ namespace odb
unsigned long long delete_statement::
execute ()
{
- if (statement* a = conn_.active ())
- a->cancel ();
+ conn_.clear ();
if (mysql_stmt_reset (stmt_))
translate_error (conn_, stmt_);