aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2014-11-21 08:16:49 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2014-11-21 08:16:49 +0200
commit77a945ec67dbf7ce2819704e80a83e5aae6bb446 (patch)
treef83183c545fac0a97ffe4648557b37c83b913724
parenta4246c978c176f0a65ca3f1501821397d829e5aa (diff)
Add support for stopping after a failed batch
-rw-r--r--odb/mssql/database.hxx27
-rw-r--r--odb/mssql/database.ixx28
2 files changed, 55 insertions, 0 deletions
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<T>::id_type
persist (const typename object_traits<T>::pointer_type& obj_ptr);
+ // Bulk persist. Can be a range of references or pointers (including
+ // smart pointers) to objects.
+ //
+ template <typename I>
+ void
+ persist (I begin, I end, bool continue_failed = true);
+
// Load an object. Throw object_not_persistent if not found.
//
template <typename T>
@@ -265,6 +272,13 @@ namespace odb
void
update (const typename object_traits<T>::pointer_type& obj_ptr);
+ // Bulk update. Can be a range of references or pointers (including
+ // smart pointers) to objects.
+ //
+ template <typename I>
+ 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<T>::pointer_type& obj_ptr);
+ // Bulk erase.
+ //
+ template <typename T, typename I>
+ 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 <typename I>
+ void
+ erase (I obj_begin, I obj_end, bool continue_failed = true);
+
// Erase multiple objects matching a query predicate.
//
template <typename T>
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_<T, id_mssql> (pobj);
}
+ template <typename I>
+ inline void database::
+ persist (I b, I e, bool cont)
+ {
+ persist_<I, id_mssql> (b, e, cont);
+ }
+
template <typename T>
inline typename object_traits<T>::pointer_type database::
load (const typename object_traits<T>::id_type& id)
@@ -261,6 +268,13 @@ namespace odb
update_<T, id_mssql> (pobj);
}
+ template <typename I>
+ inline void database::
+ update (I b, I e, bool cont)
+ {
+ update_<I, id_mssql> (b, e, cont);
+ }
+
template <typename T>
inline void database::
update (const T& obj, const section& s)
@@ -350,6 +364,20 @@ namespace odb
erase_<T, id_mssql> (pobj);
}
+ template <typename T, typename I>
+ inline void database::
+ erase (I idb, I ide, bool cont)
+ {
+ erase_id_<I, T, id_mssql> (idb, ide, cont);
+ }
+
+ template <typename I>
+ inline void database::
+ erase (I ob, I oe, bool cont)
+ {
+ erase_object_<I, id_mssql> (ob, oe, cont);
+ }
+
template <typename T>
inline unsigned long long database::
erase_query ()