session progress
This commit is contained in:
@@ -21,7 +21,7 @@ postgres_statement::~postgres_statement() {
|
||||
utils::result<sql::execute_result, utils::error> postgres_statement::execute(const sql::parameter_binder& bindings) {
|
||||
const auto* postgres_bindings = dynamic_cast<const postgres_parameter_binder*>(&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::ExecuteFailed, "Failed to cast bindings to postgres bindings"));
|
||||
}
|
||||
|
||||
if (query_.command == sql::sql_command::Insert) {
|
||||
@@ -37,7 +37,7 @@ utils::result<sql::execute_result, utils::error> postgres_statement::execute(con
|
||||
0);
|
||||
|
||||
if (is_result_error(res)) {
|
||||
return utils::failure(make_error(sql::error_code::EXECUTE_FAILED, res, db_, "Failed to execute statement", query_.sql));
|
||||
return utils::failure(make_error(sql::error_code::ExecuteFailed, res, db_, "Failed to execute statement", query_.sql));
|
||||
}
|
||||
|
||||
size_t value{0};
|
||||
@@ -53,7 +53,7 @@ utils::result<sql::execute_result, utils::error> postgres_statement::execute(con
|
||||
utils::result<std::unique_ptr<sql::query_result_impl>, utils::error> postgres_statement::fetch(const sql::parameter_binder& bindings) {
|
||||
const auto* postgres_bindings = dynamic_cast<const postgres_parameter_binder*>(&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::ExecuteFailed, "Failed to cast bindings to postgres bindings"));
|
||||
}
|
||||
PGresult *res = PQexecPrepared(db_,
|
||||
name_.c_str(),
|
||||
@@ -64,7 +64,7 @@ utils::result<std::unique_ptr<sql::query_result_impl>, utils::error> postgres_st
|
||||
0);
|
||||
|
||||
if (is_result_error(res)) {
|
||||
return utils::failure(make_error(sql::error_code::FETCH_FAILED, res, db_, "Failed to fetch statement", query_.sql));
|
||||
return utils::failure(make_error(sql::error_code::FetchFailed, res, db_, "Failed to fetch statement", query_.sql));
|
||||
}
|
||||
|
||||
return utils::ok(std::make_unique<sql::query_result_impl>(std::make_unique<postgres_result_reader>(res),
|
||||
|
||||
Reference in New Issue
Block a user