added markers for handling insert

This commit is contained in:
Sascha Kühl 2026-02-10 16:30:39 +01:00
parent 40b163ac39
commit 881e93e0f6
2 changed files with 8 additions and 0 deletions

View File

@ -143,6 +143,9 @@ utils::result<std::unique_ptr<sql::statement_impl>, utils::error> postgres_conne
} }
utils::result<sql::execute_result, utils::error> postgres_connection::execute(const sql::query_context &context) { utils::result<sql::execute_result, utils::error> postgres_connection::execute(const sql::query_context &context) {
if (context.command == sql::sql_command::Insert) {
// handle insert command with the primary key generator strategy
}
PGresult *res = PQexec(conn_, context.sql.c_str()); PGresult *res = PQexec(conn_, context.sql.c_str());
if (const auto status = PQresultStatus(res); status != PGRES_COMMAND_OK && status != PGRES_TUPLES_OK) { if (const auto status = PQresultStatus(res); status != PGRES_COMMAND_OK && status != PGRES_TUPLES_OK) {

View File

@ -23,6 +23,11 @@ utils::result<sql::execute_result, utils::error> postgres_statement::execute(con
if (!postgres_bindings) { if (!postgres_bindings) {
return utils::failure(utils::error(sql::error_code::EXECUTE_FAILED, "Failed to cast bindings to postgres bindings")); return utils::failure(utils::error(sql::error_code::EXECUTE_FAILED, "Failed to cast bindings to postgres bindings"));
} }
if (query_.command == sql::sql_command::Insert) {
// handle insert command with the primary key generator strategy
}
PGresult *res = PQexecPrepared(db_, PGresult *res = PQexecPrepared(db_,
name_.c_str(), name_.c_str(),
static_cast<int>(postgres_bindings->params().values.size()), static_cast<int>(postgres_bindings->params().values.size()),