summaryrefslogtreecommitdiff
path: root/odb/relational/source.hxx
diff options
context:
space:
mode:
Diffstat (limited to 'odb/relational/source.hxx')
-rw-r--r--odb/relational/source.hxx14
1 files changed, 10 insertions, 4 deletions
diff --git a/odb/relational/source.hxx b/odb/relational/source.hxx
index 6f80bbe..741b97d 100644
--- a/odb/relational/source.hxx
+++ b/odb/relational/source.hxx
@@ -2279,17 +2279,23 @@ namespace relational
<< "bind (idb.bind, i);"
<< "sts.id_image_version (i.version);"
<< "idb.version++;"
- << "}"
- << "if (sts.erase_statement ().execute () != 1)" << endl
- << "throw object_not_persistent ();";
+ << "}";
+ // Erase containers first so that there are no reference
+ // violations (we don't want to reply on ON DELETE CASCADE
+ // here since in case of a custom schema, it might not be
+ // there).
+ //
if (straight_containers)
{
- os << endl;
instance<container_calls> t (container_calls::erase_call);
t->traverse (c);
+ os << endl;
}
+ os << "if (sts.erase_statement ().execute () != 1)" << endl
+ << "throw object_not_persistent ();";
+
os << "}";
// find ()