From 1feaef1c1e2c8daba97b20e1fb012706c6adf1ce Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Mon, 22 Aug 2011 11:47:55 +0200 Subject: Add database::erase_query() function New test: common/erase-query. Documentation is in Section 3.9, "Deleting Persistent Objects". The current implementation does not work well with the session (no removal of the erased objects from the cache). --- odb/database.txx | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'odb/database.txx') diff --git a/odb/database.txx b/odb/database.txx index 832c7ad..e60d7a8 100644 --- a/odb/database.txx +++ b/odb/database.txx @@ -208,6 +208,21 @@ namespace odb } template + unsigned long long database:: + erase_query (const odb::query::object_type>& q) + { + // T can be const T while object_type will always be T. + // + typedef typename odb::object_traits::object_type object_type; + typedef odb::object_traits object_traits; + + if (!transaction::has_current ()) + throw not_in_transaction (); + + return object_traits::erase_query (*this, q); + } + + template result database:: query (const odb::query::object_type>& q, bool cache) -- cgit v1.1