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
commit13b215e2206380d856137dedf522c9141a58e9e0 (patch)
treeeaaa8f9e95add9ef5d24160ad7cd2efd91472c01
parent6b51de56026cf73f0f0ed8071e5e4918bc1999f9 (diff)
Add support for stopping after a failed batch
-rw-r--r--odb/database.hxx20
-rw-r--r--odb/database.ixx20
-rw-r--r--odb/database.txx20
3 files changed, 30 insertions, 30 deletions
diff --git a/odb/database.hxx b/odb/database.hxx
index 3163c46..0de867f 100644
--- a/odb/database.hxx
+++ b/odb/database.hxx
@@ -87,7 +87,7 @@ namespace odb
//
template <typename I>
void
- persist (I begin, I end);
+ persist (I begin, I end, bool continue_failed = true);
// Load an object. Throw object_not_persistent if not found.
//
@@ -180,7 +180,7 @@ namespace odb
//
template <typename I>
void
- update (I begin, I end);
+ update (I begin, I end, bool continue_failed = true);
// Update a section of an object. Throws section_not_loaded exception
// if section is not loaded. Note also that this function does not
@@ -229,14 +229,14 @@ namespace odb
//
template <typename T, typename I>
void
- erase (I id_begin, I id_end);
+ 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);
+ erase (I obj_begin, I obj_end, bool continue_failed = true);
// Erase multiple objects matching a query predicate.
//
@@ -523,15 +523,15 @@ namespace odb
template <typename I, database_id DB>
void
- persist_ (I, I);
+ persist_ (I, I, bool);
template <typename I, typename T, database_id DB>
void
- persist_ (I, I, details::meta::no ptr);
+ persist_ (I, I, bool, details::meta::no ptr);
template <typename I, typename T, database_id DB>
void
- persist_ (I, I, details::meta::yes ptr);
+ persist_ (I, I, bool, details::meta::yes ptr);
template <typename T, database_id DB>
typename object_traits<T>::pointer_type
@@ -567,7 +567,7 @@ namespace odb
template <typename I, database_id DB>
void
- update_ (I, I);
+ update_ (I, I, bool);
template <typename T, database_id DB>
void
@@ -587,11 +587,11 @@ namespace odb
template <typename I, typename T, database_id DB>
void
- erase_id_ (I, I);
+ erase_id_ (I, I, bool);
template <typename I, database_id DB>
void
- erase_object_ (I, I);
+ erase_object_ (I, I, bool);
template <typename T, database_id DB, typename Q>
typename object_traits<T>::pointer_type
diff --git a/odb/database.ixx b/odb/database.ixx
index 7c4b322..43dae6a 100644
--- a/odb/database.ixx
+++ b/odb/database.ixx
@@ -237,9 +237,9 @@ namespace odb
template <typename I>
inline void database::
- persist (I b, I e)
+ persist (I b, I e, bool cont)
{
- persist_<I, id_common> (b, e);
+ persist_<I, id_common> (b, e, cont);
}
template <typename T>
@@ -405,9 +405,9 @@ namespace odb
template <typename I>
inline void database::
- update (I b, I e)
+ update (I b, I e, bool cont)
{
- update_<I, id_common> (b, e);
+ update_<I, id_common> (b, e, cont);
}
template <typename T>
@@ -501,16 +501,16 @@ namespace odb
template <typename T, typename I>
inline void database::
- erase (I idb, I ide)
+ erase (I idb, I ide, bool cont)
{
- erase_id_<I, T, id_common> (idb, ide);
+ erase_id_<I, T, id_common> (idb, ide, cont);
}
template <typename I>
inline void database::
- erase (I ob, I oe)
+ erase (I ob, I oe, bool cont)
{
- erase_object_<I, id_common> (ob, oe);
+ erase_object_<I, id_common> (ob, oe, cont);
}
template <typename T>
@@ -722,7 +722,7 @@ namespace odb
//
template <typename I, database_id DB>
inline void database::
- persist_ (I b, I e)
+ persist_ (I b, I e, bool cont)
{
// Sun CC with non-standard STL does not have iterator_traits.
//
@@ -737,7 +737,7 @@ namespace odb
typedef object_pointer_traits<value_type> opt;
persist_<I, typename opt::object_type, id_common> (
- b, e, typename opt::result_type ());
+ b, e, cont, typename opt::result_type ());
}
template <typename T, database_id DB>
diff --git a/odb/database.txx b/odb/database.txx
index ba10891..4329754 100644
--- a/odb/database.txx
+++ b/odb/database.txx
@@ -77,7 +77,7 @@ namespace odb
template <typename I, typename T, database_id DB>
void database::
- persist_ (I b, I e, details::meta::no /*ptr*/)
+ persist_ (I b, I e, bool cont, details::meta::no /*ptr*/)
{
// T can be const T while object_type will always be T.
//
@@ -87,7 +87,7 @@ namespace odb
multiple_exceptions mex (typeid (object_already_persistent));
try
{
- while (b != e)
+ while (b != e && (cont || mex.empty ()))
{
std::size_t n (0);
T* a[object_traits::batch]; // T instead of persist_type for cache.
@@ -158,7 +158,7 @@ namespace odb
template <typename I, typename T, database_id DB>
void database::
- persist_ (I b, I e, details::meta::yes /*ptr*/)
+ persist_ (I b, I e, bool cont, details::meta::yes /*ptr*/)
{
// T can be const T while object_type will always be T.
//
@@ -170,7 +170,7 @@ namespace odb
multiple_exceptions mex (typeid (object_already_persistent));
try
{
- while (b != e)
+ while (b != e && (cont || mex.empty ()))
{
std::size_t n (0);
typename persist_type<object_type>::type* a[object_traits::batch];
@@ -269,7 +269,7 @@ namespace odb
template <typename I, database_id DB>
void database::
- update_ (I b, I e)
+ update_ (I b, I e, bool cont)
{
// Sun CC with non-standard STL does not have iterator_traits.
//
@@ -294,7 +294,7 @@ namespace odb
multiple_exceptions mex (typeid (object_not_persistent));
try
{
- while (b != e)
+ while (b != e && (cont || mex.empty ()))
{
std::size_t n (0);
const object_type* a[object_traits::batch];
@@ -344,7 +344,7 @@ namespace odb
template <typename I, typename T, database_id DB>
void database::
- erase_id_ (I b, I e)
+ erase_id_ (I b, I e, bool cont)
{
// T is explicitly specified by the caller, so assume it is object type.
//
@@ -355,7 +355,7 @@ namespace odb
multiple_exceptions mex (typeid (object_not_persistent));
try
{
- while (b != e)
+ while (b != e && (cont || mex.empty ()))
{
std::size_t n (0);
const id_type* a[object_traits::batch];
@@ -388,7 +388,7 @@ namespace odb
template <typename I, database_id DB>
void database::
- erase_object_ (I b, I e)
+ erase_object_ (I b, I e, bool cont)
{
// Sun CC with non-standard STL does not have iterator_traits.
//
@@ -413,7 +413,7 @@ namespace odb
multiple_exceptions mex (typeid (object_not_persistent));
try
{
- while (b != e)
+ while (b != e && (cont || mex.empty ()))
{
std::size_t n (0);
const object_type* a[object_traits::batch];