From ec6b9f59d40b2c389496f8e6af6bce64944af998 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Tue, 10 Aug 2010 11:16:42 +0200 Subject: Add query support --- odb/database.txx | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'odb/database.txx') diff --git a/odb/database.txx b/odb/database.txx index 402fc0b..7440127 100644 --- a/odb/database.txx +++ b/odb/database.txx @@ -92,4 +92,28 @@ namespace odb object_traits::erase (*this, id); } + + template + shared_ptr > database:: + query () + { + return query (odb::query ()); + } + + template + shared_ptr > database:: + query (const std::string& q) + { + return query (odb::query (q)); + } + + template + shared_ptr > database:: + query (const odb::query& q) + { + if (!transaction::has_current ()) + throw not_in_transaction (); + + return object_traits::query (*this, q); + } } -- cgit v1.1