aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2014-09-19 14:43:55 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2014-09-19 14:43:55 +0200
commit6de3db919419051a68082a64b107ce2ca52e72ad (patch)
tree78d9dad84a7a66eab87d6ef1f6dff756fd70d8d0
parent21c181a6bab942b95e7b8c169fcf14acc0cbb3fd (diff)
Call tracer::prepare() before actually preparing statement
This way we give the user the ability to see an invalid statement that would cause the preparation step to fail.
-rw-r--r--odb/mysql/statement.cxx25
1 files changed, 14 insertions, 11 deletions
diff --git a/odb/mysql/statement.cxx b/odb/mysql/statement.cxx
index afc6656..4b80913 100644
--- a/odb/mysql/statement.cxx
+++ b/odb/mysql/statement.cxx
@@ -183,19 +183,22 @@ namespace odb
statement::
~statement ()
{
+ if (stmt_ != 0)
{
- odb::tracer* t;
- if ((t = conn_.transaction_tracer ()) ||
- (t = conn_.tracer ()) ||
- (t = conn_.database ().tracer ()))
- t->deallocate (conn_, *this);
- }
+ {
+ odb::tracer* t;
+ if ((t = conn_.transaction_tracer ()) ||
+ (t = conn_.tracer ()) ||
+ (t = conn_.database ().tracer ()))
+ t->deallocate (conn_, *this);
+ }
- // Let the connection handle the release of the statement (it
- // may delay the actual freeing if it will mess up the currently
- // active statement).
- //
- conn_.free_stmt_handle (stmt_);
+ // Let the connection handle the release of the statement (it
+ // may delay the actual freeing if it will mess up the currently
+ // active statement).
+ //
+ conn_.free_stmt_handle (stmt_);
+ }
}
const char* statement::