summaryrefslogtreecommitdiff
path: root/source/fud_sqlite.cpp
diff options
context:
space:
mode:
authorDominick Allen <djallen@librehumanitas.org>2025-01-04 12:02:45 -0600
committerDominick Allen <djallen@librehumanitas.org>2025-01-04 12:02:45 -0600
commit1d357adfa19725ee69fb267a363f1fd217b1272f (patch)
tree8d8710ba8ba7dff0b3da6b073fbb94f1a7b03ec5 /source/fud_sqlite.cpp
parent0b400af9519444deef4cc6ad2c43c30e2092ab4f (diff)
Various style fixes.HEADmaster
Diffstat (limited to 'source/fud_sqlite.cpp')
-rw-r--r--source/fud_sqlite.cpp24
1 files changed, 17 insertions, 7 deletions
diff --git a/source/fud_sqlite.cpp b/source/fud_sqlite.cpp
index 735389f..4a7187f 100644
--- a/source/fud_sqlite.cpp
+++ b/source/fud_sqlite.cpp
@@ -26,23 +26,33 @@ SqliteDbResult SqliteDb::make(const String& name, SqliteOpenMode mode, int extra
if (copyResult != FudStatus::Success) {
return SqliteDbResult::error(copyResult);
}
- sqlDb.m_mode = mode;
- sqlDb.m_extraFlags = extraFlags;
- auto status = sqlDb.initialize();
- if (status != FudStatus::Success) {
- return SqliteDbResult::error(status);
+ return finishMake(mode, extraFlags, std::move(sqlDb));
+}
+
+SqliteDbResult SqliteDb::make(StringView name, SqliteOpenMode mode, int extraFlags)
+{
+ SqliteDb sqlDb{};
+ auto nameResult{String::from(name)};
+ if (nameResult.isError()) {
+ return SqliteDbResult::error(nameResult.takeError());
}
- return SqliteDbResult::okay(std::move(sqlDb));
+ sqlDb.m_name = nameResult.takeOkay();
+ return finishMake(mode, extraFlags, std::move(sqlDb));
}
SqliteDbResult SqliteDb::make(const char* cStrName, SqliteOpenMode mode, int extraFlags)
{
+ SqliteDb sqlDb{};
auto nameResult = String::makeFromCString(cStrName);
if (nameResult.isError()) {
return SqliteDbResult::error(nameResult);
}
- SqliteDb sqlDb{};
sqlDb.m_name = nameResult.takeOkay();
+ return finishMake(mode, extraFlags, std::move(sqlDb));
+}
+
+SqliteDbResult SqliteDb::finishMake(SqliteOpenMode& mode, int& extraFlags, SqliteDb&& sqlDb)
+{
sqlDb.m_mode = mode;
sqlDb.m_extraFlags = extraFlags;
auto status = sqlDb.initialize();