From 1be330551017742b923b324ea4534e592f43397e Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Mon, 20 Sep 2010 14:24:17 +0200 Subject: Cache result by default --- odb/database.txx | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'odb/database.txx') 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 result database:: - query (const odb::query& q) + query (const odb::query& q, bool cache) { if (!transaction::has_current ()) throw not_in_transaction (); - return object_traits::query (*this, q); + result r (object_traits::query (*this, q)); + + if (cache) + r.cache (); + + return r; } } -- cgit v1.1