From c278c2e12cdef9ac67e073d651f23aa65c831f98 Mon Sep 17 00:00:00 2001 From: Constantin Michael Date: Tue, 5 Jul 2011 13:03:27 +0200 Subject: Use fine grained fetch control provided by select_statement --- odb/pgsql/result.hxx | 1 - odb/pgsql/result.txx | 13 ++++--------- 2 files changed, 4 insertions(+), 10 deletions(-) (limited to 'odb') 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 statement_; object_statements& 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& sts) : odb::result_impl (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 (); } } } -- cgit v1.1