From 3f3e9b5735d7a9b185215f52dd96a39e0282c8c1 Mon Sep 17 00:00:00 2001 From: "Scott E. Graves" Date: Tue, 1 Oct 2024 08:45:54 -0500 Subject: [PATCH] refactor --- repertory/librepertory/src/database/db_common.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/repertory/librepertory/src/database/db_common.cpp b/repertory/librepertory/src/database/db_common.cpp index f95ca3cd..b1470741 100644 --- a/repertory/librepertory/src/database/db_common.cpp +++ b/repertory/librepertory/src/database/db_common.cpp @@ -31,13 +31,14 @@ namespace repertory::db { sqlite3_free(err_msg); err_msg = nullptr; } - if (res != SQLITE_OK) { - err = "failed to execute sql|" + sql + "|" + std::to_string(res) + '|' + - (err.empty() ? sqlite3_errstr(res) : err); - return false; + + if (res == SQLITE_OK) { + return true; } - return true; + err = "failed to execute sql|" + sql + "|" + std::to_string(res) + '|' + + (err.empty() ? sqlite3_errstr(res) : err); + return false; } void set_journal_mode(sqlite3 &db3) {