From 3f984b260e67ee5f2ac3cb9b85e0f3f2f95a7fc7 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Fri, 10 Sep 2010 12:57:27 +0200 Subject: Add support for result caching --- odb/result.hxx | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'odb') 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 () -- cgit v1.1