From bef81b1627c2c31dc22cd2b18920ed8db230a94c Mon Sep 17 00:00:00 2001 From: Constantin Michael Date: Mon, 4 Jul 2011 10:10:15 +0200 Subject: Add additional functionality required by query implementation --- odb/pgsql/statement.cxx | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) (limited to 'odb/pgsql/statement.cxx') diff --git a/odb/pgsql/statement.cxx b/odb/pgsql/statement.cxx index e4bea6d..2c2bd8b 100644 --- a/odb/pgsql/statement.cxx +++ b/odb/pgsql/statement.cxx @@ -32,15 +32,25 @@ namespace odb { try { - string s ("deallocate "); - s += name_; - PQexec (conn_.handle (), s.c_str ()); + deallocate (); } catch (...) { } } + void statement:: + deallocate () + { + if (deallocated_) + return; + + string s ("deallocate "); + s += name_; + PQexec (conn_.handle (), s.c_str ()); + deallocated_ = true; + } + statement:: statement (connection& conn, const string& name, @@ -48,7 +58,8 @@ namespace odb const Oid* types, size_t types_count) : conn_ (conn), - name_ (name) + name_ (name), + deallocated_ (false) { result_ptr r (PQprepare (conn_.handle (), name_.c_str (), @@ -326,6 +337,8 @@ namespace odb free_result () { result_.reset (); + row_count_ = 0; + current_row_ = 0; } // -- cgit v1.1