diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2012-10-08 11:56:00 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2012-10-08 11:56:00 +0200 |
commit | 46b2db37445b97cd3dbb8acd4f417e0851a30e4f (patch) | |
tree | 4344ebf0ed702b7a3148b8d6c695319982e9fb52 /odb/mysql/simple-object-result.txx | |
parent | ecfffbc56def1cfc87d34a70c0fb9f9241459e54 (diff) |
More query result size() fixes
Diffstat (limited to 'odb/mysql/simple-object-result.txx')
-rw-r--r-- | odb/mysql/simple-object-result.txx | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/odb/mysql/simple-object-result.txx b/odb/mysql/simple-object-result.txx index f67827c..b5a5f3a 100644 --- a/odb/mysql/simple-object-result.txx +++ b/odb/mysql/simple-object-result.txx @@ -102,6 +102,9 @@ namespace odb { this->current (pointer_type ()); + if (this->end_) + return; + // If we are cached, simply increment the position and // postpone the actual row fetching until later. This way // if the same object is loaded in between iteration, the @@ -193,9 +196,10 @@ namespace odb { statement_->cache (); - if (count_ >= statement_->result_size ()) + if (count_ == statement_->result_size ()) { statement_->free_result (); + count_++; // One past the result size. this->end_ = true; } } @@ -213,9 +217,7 @@ namespace odb return statement_->result_size (); } else - // If count is not zero, then it is one past the result size. - // - return count_ == 0 ? 0 : count_ - 1; + return count_ - 1; // One past the result size. } } } |