aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorConstantin Michael <constantin@codesynthesis.com>2011-07-04 10:10:15 +0200
committerConstantin Michael <constantin@codesynthesis.com>2011-07-04 10:10:15 +0200
commitbef81b1627c2c31dc22cd2b18920ed8db230a94c (patch)
treee51e4ef2fe43c710182581011b827e0851e4426c
parent137abdfb24c98375a61ed9ac08f3d37e9e07fee5 (diff)
Add additional functionality required by query implementation
-rw-r--r--odb/pgsql/statement.cxx21
-rw-r--r--odb/pgsql/statement.hxx17
2 files changed, 34 insertions, 4 deletions
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;
}
//
diff --git a/odb/pgsql/statement.hxx b/odb/pgsql/statement.hxx
index 863af53..146a34f 100644
--- a/odb/pgsql/statement.hxx
+++ b/odb/pgsql/statement.hxx
@@ -33,6 +33,9 @@ namespace odb
virtual
~statement () = 0;
+ void
+ deallocate ();
+
protected:
statement (connection&,
const std::string& name,
@@ -62,6 +65,9 @@ namespace odb
protected:
connection& conn_;
std::string name_;
+
+ private:
+ bool deallocated_;
};
class LIBODB_PGSQL_EXPORT select_statement: public statement
@@ -92,6 +98,17 @@ namespace odb
void
execute ();
+ void
+ cache () const
+ {
+ }
+
+ std::size_t
+ result_size () const
+ {
+ return row_count_;
+ }
+
// Load next row columns into bound buffers.
//
result