diff options
author | Constantin Michael <constantin@codesynthesis.com> | 2011-07-05 13:03:27 +0200 |
---|---|---|
committer | Constantin Michael <constantin@codesynthesis.com> | 2011-07-05 13:03:27 +0200 |
commit | c278c2e12cdef9ac67e073d651f23aa65c831f98 (patch) | |
tree | 184f3293c76b5918b2ca6d60064c404e60401c6e | |
parent | 0fba3bc7e0747e23ca2698e0acc82e80b569e531 (diff) |
Use fine grained fetch control provided by select_statement
-rw-r--r-- | odb/pgsql/result.hxx | 1 | ||||
-rw-r--r-- | odb/pgsql/result.txx | 13 |
2 files changed, 4 insertions, 10 deletions
diff --git a/odb/pgsql/result.hxx b/odb/pgsql/result.hxx index 9510680..6a8b6a4 100644 --- a/odb/pgsql/result.hxx +++ b/odb/pgsql/result.hxx @@ -66,7 +66,6 @@ namespace odb private: details::shared_ptr<select_statement> statement_; object_statements<object_type>& statements_; - std::size_t count_; }; } } diff --git a/odb/pgsql/result.txx b/odb/pgsql/result.txx index f96fe81..d0afe1c 100644 --- a/odb/pgsql/result.txx +++ b/odb/pgsql/result.txx @@ -22,8 +22,7 @@ namespace odb object_statements<object_type>& sts) : odb::result_impl<T> (sts.connection ().database ()), statement_ (st), - statements_ (sts), - count_ (0) + statements_ (sts) { } @@ -75,11 +74,7 @@ namespace odb { this->current (pointer_type ()); - // Increment the position and postpone the actual row fetching - // until later. This way if the same object is loaded in between - // iteration, the image won't be messed up. - // - if (++count_ > statement_->result_size ()) + if (!statement_->next ()) this->end_ = true; } @@ -100,7 +95,7 @@ namespace odb b.version++; } - select_statement::result r (statement_->fetch ()); + select_statement::result r (statement_->load ()); if (r == select_statement::truncated) { @@ -113,7 +108,7 @@ namespace odb object_traits::bind (b.bind, im, true); statements_.out_image_version (im.version); b.version++; - statement_->refetch (); + statement_->reload (); } } } |