From e00e4fda8b63fbcd21f4f79902e6b3d5d2d2be8a Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Fri, 21 Nov 2014 08:16:49 +0200 Subject: Add support for stopping after a failed batch --- odb/oracle/database.hxx | 27 +++++++++++++++++++++++++++ odb/oracle/database.ixx | 28 ++++++++++++++++++++++++++++ 2 files changed, 55 insertions(+) diff --git a/odb/oracle/database.hxx b/odb/oracle/database.hxx index a7df050..cea2bf6 100644 --- a/odb/oracle/database.hxx +++ b/odb/oracle/database.hxx @@ -121,6 +121,13 @@ namespace odb typename object_traits::id_type persist (const typename object_traits::pointer_type& obj_ptr); + // Bulk persist. Can be a range of references or pointers (including + // smart pointers) to objects. + // + template + void + persist (I begin, I end, bool continue_failed = true); + // Load an object. Throw object_not_persistent if not found. // template @@ -207,6 +214,13 @@ namespace odb void update (const typename object_traits::pointer_type& obj_ptr); + // Bulk update. Can be a range of references or pointers (including + // smart pointers) to objects. + // + template + void + update (I begin, I end, bool continue_failed = true); + // Update a section of an object. Throws the section_not_loaded // exception if the section is not loaded. Note also that this // function does not clear the changed flag if it is set. @@ -250,6 +264,19 @@ namespace odb void erase (const typename object_traits::pointer_type& obj_ptr); + // Bulk erase. + // + template + void + erase (I id_begin, I id_end, bool continue_failed = true); + + // Can be a range of references or pointers (including smart pointers) + // to objects. + // + template + void + erase (I obj_begin, I obj_end, bool continue_failed = true); + // Erase multiple objects matching a query predicate. // template diff --git a/odb/oracle/database.ixx b/odb/oracle/database.ixx index ff2afea..e6a698e 100644 --- a/odb/oracle/database.ixx +++ b/odb/oracle/database.ixx @@ -100,6 +100,13 @@ namespace odb return persist_ (pobj); } + template + inline void database:: + persist (I b, I e, bool cont) + { + persist_ (b, e, cont); + } + template inline typename object_traits::pointer_type database:: load (const typename object_traits::id_type& id) @@ -261,6 +268,13 @@ namespace odb update_ (pobj); } + template + inline void database:: + update (I b, I e, bool cont) + { + update_ (b, e, cont); + } + template inline void database:: update (const T& obj, const section& s) @@ -350,6 +364,20 @@ namespace odb erase_ (pobj); } + template + inline void database:: + erase (I idb, I ide, bool cont) + { + erase_id_ (idb, ide, cont); + } + + template + inline void database:: + erase (I ob, I oe, bool cont) + { + erase_object_ (ob, oe, cont); + } + template inline unsigned long long database:: erase_query () -- cgit v1.1