summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--slicer/db/sqlInsertSerializer.cpp5
-rw-r--r--slicer/db/sqlUpdateSerializer.cpp5
-rw-r--r--slicer/slicer/modelPartsTypes.impl.h6
3 files changed, 4 insertions, 12 deletions
diff --git a/slicer/db/sqlInsertSerializer.cpp b/slicer/db/sqlInsertSerializer.cpp
index 6c4cf31..e90fbf2 100644
--- a/slicer/db/sqlInsertSerializer.cpp
+++ b/slicer/db/sqlInsertSerializer.cpp
@@ -41,11 +41,8 @@ namespace Slicer {
void
SqlInsertSerializer::SerializeSequence(Slicer::ModelPartPtr mp) const
{
- ModifyPtr ins;
+ ModifyPtr ins = createInsert(mp->GetContainedModelPart());
mp->OnEachChild([&ins, this](const std::string &, ModelPartPtr cmp, HookCommonPtr) {
- if (!ins) {
- ins = createInsert(cmp);
- }
bindObjectAndExecute(cmp, ins.get());
});
}
diff --git a/slicer/db/sqlUpdateSerializer.cpp b/slicer/db/sqlUpdateSerializer.cpp
index a2a1fc2..ce9d868 100644
--- a/slicer/db/sqlUpdateSerializer.cpp
+++ b/slicer/db/sqlUpdateSerializer.cpp
@@ -40,11 +40,8 @@ namespace Slicer {
void
SqlUpdateSerializer::SerializeSequence(Slicer::ModelPartPtr mp) const
{
- ModifyPtr ins;
+ ModifyPtr ins = createUpdate(mp->GetContainedModelPart());
mp->OnEachChild([&ins, this](const std::string &, ModelPartPtr cmp, HookCommonPtr) {
- if (!ins) {
- ins = createUpdate(cmp);
- }
bindObjectAndExecute(cmp, ins.get());
});
}
diff --git a/slicer/slicer/modelPartsTypes.impl.h b/slicer/slicer/modelPartsTypes.impl.h
index 43adc1e..9b9a5a7 100644
--- a/slicer/slicer/modelPartsTypes.impl.h
+++ b/slicer/slicer/modelPartsTypes.impl.h
@@ -164,8 +164,7 @@ namespace Slicer {
ModelPartForOptional<T>::ModelPartForOptional(IceUtil::Optional< typename T::element_type > * h) :
ModelPartModel<IceUtil::Optional< typename T::element_type> >(h)
{
- BOOST_ASSERT(this->Model);
- if (*this->Model) {
+ if (hasModel()) {
modelPart = new T(&**this->Model);
}
}
@@ -173,8 +172,7 @@ namespace Slicer {
template<typename T>
bool ModelPartForOptional<T>::hasModel() const
{
- BOOST_ASSERT(this->Model);
- return *this->Model;
+ return this->Model && *this->Model;
}
template<typename T>