fixed schema creation

This commit is contained in:
Sascha Kühl
2025-12-04 16:06:39 +01:00
parent 19eb54df8d
commit 980cabe94f
12 changed files with 152 additions and 95 deletions
@@ -111,10 +111,10 @@ utils::result<std::unique_ptr<sql::query_result_impl>, utils::error> postgres_co
std::string postgres_connection::generate_statement_name(const sql::query_context &query) {
std::stringstream name;
name << query.table_name << "_" << query.command_name;
auto result = postgres_connection::statement_name_map_.find(name.str());
auto result = statement_name_map_.find(name.str());
if (result == postgres_connection::statement_name_map_.end()) {
result = postgres_connection::statement_name_map_.insert(std::make_pair(name.str(), 0)).first;
if (result == statement_name_map_.end()) {
result = statement_name_map_.insert(std::make_pair(name.str(), 0)).first;
}
name << "_" << ++result->second;
@@ -123,7 +123,7 @@ std::string postgres_connection::generate_statement_name(const sql::query_contex
}
utils::result<std::unique_ptr<sql::statement_impl>, utils::error> postgres_connection::prepare(const sql::query_context &context) {
auto statement_name = postgres_connection::generate_statement_name(context);
auto statement_name = generate_statement_name(context);
const PGresult *result = PQprepare(conn_, statement_name.c_str(), context.sql.c_str(),
static_cast<int>(context.bind_vars.size()), nullptr);