fixed backend tests

This commit is contained in:
Sascha Kühl
2025-02-13 16:13:20 +01:00
parent 2efb106fc3
commit 336b2a7342
17 changed files with 142 additions and 46 deletions
@@ -20,7 +20,7 @@ postgres_connection::postgres_connection(const sql::connection_info &info)
}
utils::result<void, utils::error> postgres_connection::open() {
if (is_open()) {
if (conn_ != nullptr) {
return utils::ok<void>();
}
@@ -221,7 +221,11 @@ utils::result<bool, utils::error> postgres_connection::exists(const std::string
return utils::failure(make_error(sql::error_code::TABLE_EXISTS_FAILED, res, conn_, "Failed check if table exists", stmt));
}
return utils::ok(utils::to<size_t>(PQcmdTuples(res)) == 1);
const auto result = utils::to<size_t>(PQcmdTuples(res));
if (!result) {
return utils::failure(make_error(sql::error_code::FAILURE, res, conn_, "Failed to convert result value", stmt));
}
return utils::ok(*result == 1);
}
std::string postgres_connection::to_escaped_string(const utils::blob& value) const