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
commite00e4fda8b63fbcd21f4f79902e6b3d5d2d2be8a (patch)
tree844c6d9201139a03fdb44887db89828c310dbdc0
parenta7eb0390b8baf5228ef0a615c657813ff86e60de (diff)
Add support for stopping after a failed batch
-rw-r--r--odb/oracle/database.hxx27
-rw-r--r--odb/oracle/database.ixx28
2 files changed, 55 insertions, 0 deletions
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<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>
@@ -207,6 +214,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.
@@ -250,6 +264,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/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_<T, id_oracle> (pobj);
}
+ template <typename I>
+ inline void database::
+ persist (I b, I e, bool cont)
+ {
+ persist_<I, id_oracle> (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_oracle> (pobj);
}
+ template <typename I>
+ inline void database::
+ update (I b, I e, bool cont)
+ {
+ update_<I, id_oracle> (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_oracle> (pobj);
}
+ template <typename T, typename I>
+ inline void database::
+ erase (I idb, I ide, bool cont)
+ {
+ erase_id_<I, T, id_oracle> (idb, ide, cont);
+ }
+
+ template <typename I>
+ inline void database::
+ erase (I ob, I oe, bool cont)
+ {
+ erase_object_<I, id_oracle> (ob, oe, cont);
+ }
+
template <typename T>
inline unsigned long long database::
erase_query ()