From 77a945ec67dbf7ce2819704e80a83e5aae6bb446 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/mssql/database.hxx | 27 +++++++++++++++++++++++++++ odb/mssql/database.ixx | 28 ++++++++++++++++++++++++++++ 2 files changed, 55 insertions(+) diff --git a/odb/mssql/database.hxx b/odb/mssql/database.hxx index 3fb0ec0..fc13974 100644 --- a/odb/mssql/database.hxx +++ b/odb/mssql/database.hxx @@ -179,6 +179,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 @@ -265,6 +272,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. @@ -308,6 +322,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/mssql/database.ixx b/odb/mssql/database.ixx index 705edb5..fc43934 100644 --- a/odb/mssql/database.ixx +++ b/odb/mssql/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