aboutsummaryrefslogtreecommitdiff
path: root/odb/pgsql/no-id-object-result.txx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2012-09-28 14:42:23 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2012-09-28 14:42:23 +0200
commit5303dd088f25ecbd5cf2b3bd423f977874223fae (patch)
treeff85ce7339c8d0838bff210dba031cbbbfbcebf3 /odb/pgsql/no-id-object-result.txx
parentf8a9600d83a7ebaa0321a59d1b2ebb53671f665d (diff)
Make sure size() can still be called once we reached the end of result set
Diffstat (limited to 'odb/pgsql/no-id-object-result.txx')
-rw-r--r--odb/pgsql/no-id-object-result.txx9
1 files changed, 6 insertions, 3 deletions
diff --git a/odb/pgsql/no-id-object-result.txx b/odb/pgsql/no-id-object-result.txx
index 98e1b48..6b1e921 100644
--- a/odb/pgsql/no-id-object-result.txx
+++ b/odb/pgsql/no-id-object-result.txx
@@ -25,7 +25,8 @@ namespace odb
statements_type& statements)
: base_type (statements.connection ().database ()),
statement_ (statement),
- statements_ (statements)
+ statements_ (statements),
+ count_ (0)
{
}
@@ -76,7 +77,9 @@ namespace odb
{
this->current (pointer_type ());
- if (!statement_->next ())
+ if (statement_->next ())
+ count_++;
+ else
{
statement_->free_result ();
this->end_ = true;
@@ -93,7 +96,7 @@ namespace odb
std::size_t no_id_object_result_impl<T>::
size ()
{
- return statement_->result_size ();
+ return this->end_ ? count_ : statement_->result_size ();
}
}
}