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

@@ -161,8 +161,11 @@ public:
template <typename context_t> struct db_result final {
db_result(std::shared_ptr<context_t> context, std::int32_t res)
: context_(std::move(context)), res_(res) {
constexpr const auto *function_name =
static_cast<const char *>(__FUNCTION__);
if (res == SQLITE_OK) {
set_res(sqlite3_step(context_->stmt.get()), __FUNCTION__);
set_res(sqlite3_step(context_->stmt.get()), function_name);
}
}
@@ -193,10 +196,13 @@ public:
[[nodiscard]] auto get_row(std::optional<db_row<context_t>> &row) const
-> bool {
constexpr const auto *function_name =
static_cast<const char *>(__FUNCTION__);
row.reset();
if (has_row()) {
row = db_row{context_};
set_res(sqlite3_step(context_->stmt.get()), __FUNCTION__);
set_res(sqlite3_step(context_->stmt.get()), function_name);
return true;
}
return false;
@@ -205,8 +211,11 @@ public:
[[nodiscard]] auto has_row() const -> bool { return res_ == SQLITE_ROW; }
void next_row() const {
constexpr const auto *function_name =
static_cast<const char *>(__FUNCTION__);
if (has_row()) {
set_res(sqlite3_step(context_->stmt.get()), __FUNCTION__);
set_res(sqlite3_step(context_->stmt.get()), function_name);
}
}
};