fixed nextval and update tests

This commit is contained in:
Sascha Kühl 2026-03-07 16:34:48 +01:00
parent 2aff0cabbb
commit 801fbdd187
3 changed files with 3 additions and 5 deletions

View File

@ -12,6 +12,7 @@ query_select_intermediate::query_select_intermediate(const std::vector<table_col
} }
fetchable_query query_select_intermediate::nextval(const std::string& sequence_name) { fetchable_query query_select_intermediate::nextval(const std::string& sequence_name) {
context_->parts.pop_back();
context_->parts.push_back(std::make_unique<internal::query_select_nextval_part>(sequence_name)); context_->parts.push_back(std::make_unique<internal::query_select_nextval_part>(sequence_name));
return {context_}; return {context_};
} }

View File

@ -100,7 +100,7 @@ void query_builder::visit(internal::query_select_part &part) {
} }
void query_builder::visit(internal::query_select_nextval_part& part) { void query_builder::visit(internal::query_select_nextval_part& part) {
query_.sql += dialect_->nextval() + "('" + part.sequence_name() + "')"; query_.sql += dialect_->select() + " " + dialect_->nextval() + "('" + part.sequence_name() + "')";
prepare_prototype(query_.prototype, part.sequence_name()); prepare_prototype(query_.prototype, part.sequence_name());
} }

View File

@ -110,10 +110,7 @@ TEST_CASE_METHOD(QueryFixture, "Test update statement", "[query][statement][upda
george.age = 36; george.age = 36;
george.image = {5,6,7,8}; george.image = {5,6,7,8};
stmt = query::update(PERSON) stmt = query::update(PERSON)
.set(PERSON.id, _) .set<person>()
.set(PERSON.name, _)
.set(PERSON.age, _)
.set(PERSON.image, _)
.where(PERSON.id == _) .where(PERSON.id == _)
.prepare(db); .prepare(db);
REQUIRE(stmt); REQUIRE(stmt);