diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2010-09-20 14:24:17 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2010-09-20 14:24:17 +0200 |
commit | 1be330551017742b923b324ea4534e592f43397e (patch) | |
tree | d598265ae720af82e9804aa6b12ee975322d1538 /odb/database.txx | |
parent | cf503d65bf38512a89fd44e94346a3ffe56d4f40 (diff) |
Cache result by default
Diffstat (limited to 'odb/database.txx')
-rw-r--r-- | odb/database.txx | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/odb/database.txx b/odb/database.txx index c037892..86336ea 100644 --- a/odb/database.txx +++ b/odb/database.txx @@ -84,11 +84,16 @@ namespace odb template <typename T> result<T> database:: - query (const odb::query<T>& q) + query (const odb::query<T>& q, bool cache) { if (!transaction::has_current ()) throw not_in_transaction (); - return object_traits<T>::query (*this, q); + result<T> r (object_traits<T>::query (*this, q)); + + if (cache) + r.cache (); + + return r; } } |