sequence tests progress

This commit is contained in:
2026-03-13 16:18:41 +01:00
parent 6bdf281eab
commit 86c9e6b1cd
14 changed files with 117 additions and 33 deletions
+22 -26
View File
@@ -1,5 +1,27 @@
# Todo
Order of next steps:
1. Finish pk generator
- classes
- detection on schema attach
- tests
2. PK accessor class
- extract from `insert_query_builder` class
- get(), set(), is_null/valid/set()
- detection on schema attach
- tests
3. Add owner-awareness to the collection class
- add owner field
- bind owner on session insert
- tests
4. Finish `insert_query_builder`
- collect all inserts for entities with relations
- tests
5. Finish `session::insert` method
- use `insert_query_builder`
- correct handling of pk generator
- tests
- move `prepare_*` methods from `dialect` to `query_compiler`
- add `insert_query_builder` and `update_update_builder` (returning multiple statements)
- finish fetch eager many-to-many relations
@@ -18,32 +40,6 @@
7. Extend `session::insert` logic to use pk generator
8. Add generator to `schema_node` or `table` class when attaching type
```cpp
struct abstract_pk_generator {
virtual ~abstract_pk_generator() = default;
virtual int64_t next_id() = 0;
virtual std::vector<int64_t> next_ids(int count) = 0;
};
struct sequence_pk_generator : abstract_pk_generator {
explicit sequence_pk_generator(const std::string& sequence_name)
: query_(query::query::select().nextval(sequence_name)) {}
int64_t next_id(sql::executor& exec) override {
return query_.fetch_value<int64_t>(exec);
}
std::vector<int64_t> next_ids(int count) override;
private:
query::fetchable_query query_;
};
struct table_pk_generator : abstract_pk_generator {
explicit table_pk_generator(const std::string& table_name);
int64_t next_id() override;
std::vector<int64_t> next_ids(int count) override;
private:
std::string table_name_;
};
```
__Proposal for polymorphic classes:__