removed class query and moved their static methods to simple functions

This commit is contained in:
2026-03-26 09:34:32 +01:00
parent 3fc08fb7ff
commit fedce38270
23 changed files with 283 additions and 286 deletions
+9 -9
View File
@@ -190,7 +190,7 @@ int main() {
mc.date_of_birth = "19.8.1954";
mc.year_of_birth = 1954;
mc.distinguished = true;
auto insert_authors_sql = query::insert()
auto insert_authors_sql = insert()
.into(AUTHOR)
.values(mc)
.execute(*c);
@@ -201,7 +201,7 @@ int main() {
return 0;
}
auto authors_result = query::select(AUTHOR)
auto authors_result = select(AUTHOR)
.from(AUTHOR)
.fetch_all(*c);
@@ -243,8 +243,8 @@ int main() {
// .values( {3, "Misery", mc.id, 1984} )
// .execute();
//
// auto select_books_sql = query::select( BOOK, {AUTHOR.last_name} )
auto select_books_sql = query::select({BOOK.id, BOOK.title, BOOK.author_id, BOOK.published_in, AUTHOR.last_name})
// auto select_books_sql = select( BOOK, {AUTHOR.last_name} )
auto select_books_sql = select({BOOK.id, BOOK.title, BOOK.author_id, BOOK.published_in, AUTHOR.last_name})
.from(BOOK)
.join_left(AUTHOR)
.on(BOOK.author_id == AUTHOR.id)
@@ -288,17 +288,17 @@ int main() {
//
// std::cout << "SQL: " << drop_authors_sql << "\n";
//
auto res = query::select({PAYLOAD.id})
auto res = select({PAYLOAD.id})
.from(PAYLOAD)
.join_left(JOB)
.on(JOB.payload == PAYLOAD.id)
.where(
in(PAYLOAD.id, query::select({JOB.state})
in(PAYLOAD.id, select({JOB.state})
.from(JOB)
.where(JOB.state == job::job_state::Running).compile(c->dialect())
.where(JOB.state == job::job_state::Running)
) &&
in(PAYLOAD.id, query::select({TEMPORARY_TABLE.id})
.from(TEMPORARY_TABLE).compile(c->dialect())
in(PAYLOAD.id, select({TEMPORARY_TABLE.id})
.from(TEMPORARY_TABLE)
)
).compile(c->dialect());
// // .fetch_value<unsigned long>();