aboutsummaryrefslogtreecommitdiff
path: root/odb/database.txx
diff options
context:
space:
mode:
Diffstat (limited to 'odb/database.txx')
-rw-r--r--odb/database.txx9
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;
}
}