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.ixx | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) (limited to 'odb/database.ixx') diff --git a/odb/database.ixx b/odb/database.ixx index a308bfe..ccbbe41 100644 --- a/odb/database.ixx +++ b/odb/database.ixx @@ -170,6 +170,39 @@ namespace odb } template + inline unsigned long long database:: + erase_query () + { + // T can be const T while object_type will always be T. + // + typedef typename odb::object_traits::object_type object_type; + + return erase_query (odb::query ()); + } + + template + inline unsigned long long database:: + erase_query (const char* q) + { + // T can be const T while object_type will always be T. + // + typedef typename odb::object_traits::object_type object_type; + + return erase_query (odb::query (q)); + } + + template + inline unsigned long long database:: + erase_query (const std::string& q) + { + // T can be const T while object_type will always be T. + // + typedef typename odb::object_traits::object_type object_type; + + return erase_query (odb::query (q)); + } + + template inline result database:: query (bool cache) { -- cgit v1.1