From 5ccb8ff28beedd9288c077f0f7509a79a819929e Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Fri, 19 Sep 2014 14:43:55 +0200 Subject: 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. --- odb/pgsql/statement.cxx | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) (limited to 'odb/pgsql') 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 h (PQexec (conn_.handle (), s.c_str ())); - deallocated_ = true; + auto_handle h (PQexec (conn_.handle (), s.c_str ())); + deallocated_ = true; + } } statement:: -- cgit v1.1