aboutsummaryrefslogtreecommitdiff
path: root/odb/mysql/no-id-object-result.txx
diff options
context:
space:
mode:
Diffstat (limited to 'odb/mysql/no-id-object-result.txx')
-rw-r--r--odb/mysql/no-id-object-result.txx10
1 files changed, 6 insertions, 4 deletions
diff --git a/odb/mysql/no-id-object-result.txx b/odb/mysql/no-id-object-result.txx
index 6418987..0f996d1 100644
--- a/odb/mysql/no-id-object-result.txx
+++ b/odb/mysql/no-id-object-result.txx
@@ -51,6 +51,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
@@ -137,9 +140,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;
}
}
@@ -157,9 +161,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.
}
}
}