diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2010-08-10 11:16:42 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2010-08-10 11:16:42 +0200 |
commit | ec6b9f59d40b2c389496f8e6af6bce64944af998 (patch) | |
tree | b042d94161432c66336972471a82dcdca9cb3eea /odb/database.txx | |
parent | 3d1ccd52f417c6e5e333e4f48130b043106215ad (diff) |
Add query support
Diffstat (limited to 'odb/database.txx')
-rw-r--r-- | odb/database.txx | 24 |
1 files changed, 24 insertions, 0 deletions
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<T>::erase (*this, id); } + + template <typename T> + shared_ptr<result_impl<T> > database:: + query () + { + return query (odb::query<T> ()); + } + + template <typename T> + shared_ptr<result_impl<T> > database:: + query (const std::string& q) + { + return query (odb::query<T> (q)); + } + + template <typename T> + shared_ptr<result_impl<T> > database:: + query (const odb::query<T>& q) + { + if (!transaction::has_current ()) + throw not_in_transaction (); + + return object_traits<T>::query (*this, q); + } } |