From f7eede23de6f78b2b33b477b2b4c5451141825d5 Mon Sep 17 00:00:00 2001 From: Dominick Allen Date: Wed, 2 Oct 2024 19:51:41 -0500 Subject: Add setup for coverage and cppcheck. --- source/fud_sqlite.cpp | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'source/fud_sqlite.cpp') diff --git a/source/fud_sqlite.cpp b/source/fud_sqlite.cpp index f573f1c..e07523d 100644 --- a/source/fud_sqlite.cpp +++ b/source/fud_sqlite.cpp @@ -58,6 +58,8 @@ SqliteDb& SqliteDb::operator=(SqliteDb&& rhs) m_nameValid = rhs.m_nameValid; m_dbHandle = rhs.m_dbHandle; m_errorCode = rhs.m_errorCode; + m_mode = rhs.m_mode; + m_extraFlags = rhs.m_extraFlags; rhs.m_nameValid = false; rhs.m_dbHandle = nullptr; @@ -94,9 +96,9 @@ FudStatus SqliteDb::exec( } char* errorMsgPtr = nullptr; - char** errorMsgPtrAddress = &errorMsgPtr; - if (errorMessage == nullptr) { - errorMsgPtrAddress = nullptr; + char** errorMsgPtrAddress = nullptr; + if (errorMessage != nullptr) { + errorMsgPtrAddress = &errorMsgPtr; } m_errorCode = sqlite3_exec( @@ -106,6 +108,10 @@ FudStatus SqliteDb::exec( context, errorMsgPtrAddress); + if (errorMessage != nullptr) { + *errorMessage = String{errorMsgPtr}; + } + return m_errorCode == SQLITE_OK ? FudStatus::Success : FudStatus::Failure; } @@ -126,10 +132,10 @@ int SqliteDb::open() return sqlite3_open_v2(m_name.c_str(), &m_dbHandle, static_cast(m_mode) | m_extraFlags, nullptr); } -Result SqliteDb::prepare(const String& dql) +Result SqliteDb::prepare(const String& sql) { using RetType = Result; - SqliteStatement preparedStatement{*this, dql}; + SqliteStatement preparedStatement{*this, sql}; if (!preparedStatement.valid() || preparedStatement.status() != FudStatus::Success) { m_errorCode = preparedStatement.errorCode(); -- cgit v1.2.3