summaryrefslogtreecommitdiff
path: root/source/fud_sqlite.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'source/fud_sqlite.cpp')
-rw-r--r--source/fud_sqlite.cpp16
1 files changed, 11 insertions, 5 deletions
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<int>(m_mode) | m_extraFlags, nullptr);
}
-Result<SqliteStatement, FudStatus> SqliteDb::prepare(const String& dql)
+Result<SqliteStatement, FudStatus> SqliteDb::prepare(const String& sql)
{
using RetType = Result<SqliteStatement, FudStatus>;
- SqliteStatement preparedStatement{*this, dql};
+ SqliteStatement preparedStatement{*this, sql};
if (!preparedStatement.valid() || preparedStatement.status() != FudStatus::Success) {
m_errorCode = preparedStatement.errorCode();