From 13a55bff613b3e58380273ab45323b5b58e19160 Mon Sep 17 00:00:00 2001 From: "Scott E. Graves" Date: Tue, 8 Oct 2024 19:14:39 -0500 Subject: [PATCH] refactor --- .../librepertory/include/database/db_common.hpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/repertory/librepertory/include/database/db_common.hpp b/repertory/librepertory/include/database/db_common.hpp index 25fa3e1a..19dcb493 100644 --- a/repertory/librepertory/include/database/db_common.hpp +++ b/repertory/librepertory/include/database/db_common.hpp @@ -212,12 +212,13 @@ public: static_cast(__FUNCTION__); row.reset(); - if (has_row()) { - row = db_row{context_}; - set_res(sqlite3_step(context_->stmt.get()), function_name); - return true; + if (not has_row()) { + return false; } - return false; + + row = db_row{context_}; + set_res(sqlite3_step(context_->stmt.get()), function_name); + return true; } [[nodiscard]] auto has_row() const -> bool { return res_ == SQLITE_ROW; } @@ -232,4 +233,5 @@ public: } }; } // namespace repertory::db + #endif // INCLUDE_DATABASE_DB_COMMON_HPP_