aboutsummaryrefslogtreecommitdiff
path: root/odb/pgsql/polymorphic-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/polymorphic-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/polymorphic-object-result.txx')
-rw-r--r--odb/pgsql/polymorphic-object-result.txx9
1 files changed, 6 insertions, 3 deletions
diff --git a/odb/pgsql/polymorphic-object-result.txx b/odb/pgsql/polymorphic-object-result.txx
index 9d50427..02a71a0 100644
--- a/odb/pgsql/polymorphic-object-result.txx
+++ b/odb/pgsql/polymorphic-object-result.txx
@@ -28,7 +28,8 @@ namespace odb
statements_type& sts)
: base_type (sts.connection ().database ()),
statement_ (st),
- statements_ (sts)
+ statements_ (sts),
+ count_ (0)
{
}
@@ -167,7 +168,9 @@ namespace odb
{
this->current (pointer_type ());
- if (!statement_->next ())
+ if (statement_->next ())
+ count_++;
+ else
{
statement_->free_result ();
this->end_ = true;
@@ -259,7 +262,7 @@ namespace odb
std::size_t polymorphic_object_result_impl<T>::
size ()
{
- return statement_->result_size ();
+ return this->end_ ? count_ : statement_->result_size ();
}
}
}