aboutsummaryrefslogtreecommitdiff
path: root/odb/result.hxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2010-09-10 12:57:27 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2010-09-10 12:57:27 +0200
commit3f984b260e67ee5f2ac3cb9b85e0f3f2f95a7fc7 (patch)
tree0e1236771e0f3058e1d0918434aee4e5c7729303 /odb/result.hxx
parent418a79b797c8e9c638b953cd78ab5c5e71ccf272 (diff)
Add support for result caching
Diffstat (limited to 'odb/result.hxx')
-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 ()