refactoring
Some checks failed
BlockStorage/repertory_osx_builds/pipeline/head This commit looks good
BlockStorage/repertory_linux_builds/pipeline/head There was a failure building this commit

This commit is contained in:
2023-12-15 17:58:49 -06:00
parent 34c4a9c508
commit 71686405e0
41 changed files with 1436 additions and 709 deletions

View File

@@ -58,14 +58,16 @@ auto db_insert::dump() const -> std::string {
}
auto db_insert::go() const -> db_result<context> {
constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__);
sqlite3_stmt *stmt_ptr{nullptr};
auto query_str = dump();
auto res = sqlite3_prepare_v2(&context_->db3, query_str.c_str(), -1,
&stmt_ptr, nullptr);
if (res != SQLITE_OK) {
utils::error::raise_error(__FUNCTION__, "failed to prepare|" +
std::to_string(res) + '|' +
sqlite3_errstr(res));
utils::error::raise_error(function_name, "failed to prepare|" +
std::to_string(res) + '|' +
sqlite3_errstr(res));
return {context_, res};
}
context_->stmt.reset(stmt_ptr);
@@ -84,9 +86,9 @@ auto db_insert::go() const -> db_result<context> {
},
std::next(context_->values.begin(), idx)->second);
if (res != SQLITE_OK) {
utils::error::raise_error(__FUNCTION__, "failed to bind|" +
std::to_string(res) + '|' +
sqlite3_errstr(res));
utils::error::raise_error(function_name, "failed to bind|" +
std::to_string(res) + '|' +
sqlite3_errstr(res));
return {context_, res};
}
}

View File

@@ -112,12 +112,14 @@ auto db_select::dump() const -> std::string {
}
auto db_select::go() const -> db_result<context> {
constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__);
sqlite3_stmt *stmt_ptr{nullptr};
auto query_str = dump();
auto res = sqlite3_prepare_v2(&context_->db3, query_str.c_str(), -1,
&stmt_ptr, nullptr);
if (res != SQLITE_OK) {
utils::error::raise_error(__FUNCTION__,
utils::error::raise_error(function_name,
"failed to prepare|" + std::to_string(res) + '|' +
sqlite3_errstr(res) + '|' + query_str);
return {context_, res};
@@ -138,7 +140,7 @@ auto db_select::go() const -> db_result<context> {
},
context_->ands.at(static_cast<std::size_t>(idx)).value);
if (res != SQLITE_OK) {
utils::error::raise_error(__FUNCTION__,
utils::error::raise_error(function_name,
"failed to bind|" + std::to_string(res) + '|' +
sqlite3_errstr(res) + '|' + query_str);
return {context_, res};