aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--odb/result.hxx15
1 files changed, 15 insertions, 0 deletions
diff --git a/odb/result.hxx b/odb/result.hxx
index 7501326..163b619 100644
--- a/odb/result.hxx
+++ b/odb/result.hxx
@@ -67,6 +67,9 @@ namespace odb
virtual void
next () = 0;
+ virtual void
+ cache () = 0;
+
protected:
void
current (pointer_type p)
@@ -216,6 +219,18 @@ namespace odb
return *this;
}
+ // Cache the result instead of fetching the data from the database
+ // one object at a time. This is necessary if you plan on performing
+ // database operations while iterating over the result.
+ //
+ public:
+ void
+ cache ()
+ {
+ if (impl_)
+ impl_->cache ();
+ }
+
public:
iterator
begin ()