session and insert query builder progress

This commit is contained in:
2026-04-17 15:16:49 +02:00
parent d734d647ed
commit f144b26dbb
2 changed files with 21 additions and 21 deletions
@@ -83,7 +83,7 @@ public:
visited_.clear();
ptr_ = ptr;
build_for(ptr);
build_for(ptr, steps_);
ptr_.reset();
// relation inserts must run after all entity inserts were collected
@@ -119,9 +119,8 @@ public:
has_many_linker<ObjectType> linker(ptr_, join_column);
for (auto &obj : objects) {
if (obj.is_transient()) {
build_for(obj);
build_for(obj, relation_steps_);
}
// obj.is_persistent() ? build_for(obj) : on_foreign_object(obj, attr);
access::process(linker, *obj);
}
@@ -154,7 +153,7 @@ public:
// Ensure target exists as dependency (deps first)
if (!obj.is_persistent()) {
using dep_t = std::remove_reference_t<decltype(*obj)>;
build_for<dep_t>(obj);
build_for<dep_t>(obj, steps_);
}
// Extract FK value from the foreign object
@@ -192,7 +191,7 @@ private:
};
template<class EntityType>
void build_for(const object::object_ptr<EntityType> &ptr) {
void build_for(const object::object_ptr<EntityType> &ptr, std::vector<insert_step> &steps) {
if (!ptr) {
return;
}
@@ -239,7 +238,7 @@ private:
step.pk_accessor.set(*ptr, id);
};
}
steps_.push_back(std::move(step));
steps.push_back(std::move(step));
}
template<class Pointer>
@@ -254,7 +253,7 @@ private:
}
using dep_t = std::remove_reference_t<decltype(*obj)>;
build_for<dep_t>(obj);
build_for<dep_t>(obj, steps_);
}
private:
const basic_schema &schema_;