some improvements to select_query_builder and started insert_query_builder

This commit is contained in:
2026-02-08 22:38:11 +01:00
parent a498efd21d
commit 54e6786ceb
10 changed files with 217 additions and 144 deletions
+1
View File
@@ -185,6 +185,7 @@ add_library(matador-orm STATIC
sql/resolver_service.cpp
sql/statement.cpp
sql/statement_cache.cpp
../../include/matador/query/insert_query_builder.hpp
)
target_include_directories(matador-orm
-9
View File
@@ -119,13 +119,4 @@ utils::result<sql::statement, utils::error> session::prepare(const sql::query_co
std::string session::str(const sql::query_context& ctx) const {
return ctx.sql;
}
query::fetchable_query session::build_select_query(query::select_query_data &&data) {
return query::query::select(data.columns)
.from(*data.root_table)
.join_left(data.joins)
.where(std::move(data.where_clause))
.order_by({data.root_table, data.pk_column_name})
.asc();
}
}
@@ -64,6 +64,10 @@ void select_query_builder::push(const std::string &column_name) {
entity_query_data_.columns.emplace_back(&it->second, column_name, build_alias('c', ++column_index));
}
const select_query_data & select_query_builder::query_data() const {
return entity_query_data_;
}
std::string select_query_builder::build_alias(const char prefix, const unsigned int count) {
char str[4];
snprintf(str, 4, "%c%02d", prefix, count);