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
commit5ccb8ff28beedd9288c077f0f7509a79a819929e (patch)
tree16abad21feb43f5ae375f76ecab2c9beb10f25bd
parent3d4d7996e0f4c5b3b4f35b443ab5de6b0c516971 (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/pgsql/statement.cxx28
1 files changed, 14 insertions, 14 deletions
diff --git a/odb/pgsql/statement.cxx b/odb/pgsql/statement.cxx
index 094aa40..cf3e181 100644
--- a/odb/pgsql/statement.cxx
+++ b/odb/pgsql/statement.cxx
@@ -66,23 +66,23 @@ namespace odb
void statement::
deallocate ()
{
- if (deallocated_)
- return;
-
+ if (!deallocated_)
{
- 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);
+ }
- string s ("deallocate \"");
- s += name_;
- s += "\"";
+ string s ("deallocate \"");
+ s += name_;
+ s += "\"";
- auto_handle<PGresult> h (PQexec (conn_.handle (), s.c_str ()));
- deallocated_ = true;
+ auto_handle<PGresult> h (PQexec (conn_.handle (), s.c_str ()));
+ deallocated_ = true;
+ }
}
statement::