refactor: remove sqlite dir path back-and-forth conversion
This commit is contained in:
2 files changed
+4
-4
No files matched your search
@@ -112,12 +112,12 @@ Mutex SQLiteDatabase::g_sqlite_mutex;
|
|||||||
int SQLiteDatabase::g_sqlite_count = 0;
|
int SQLiteDatabase::g_sqlite_count = 0;
|
||||||
|
|
||||||
SQLiteDatabase::SQLiteDatabase(const fs::path& dir_path, const fs::path& file_path, const DatabaseOptions& options, bool mock)
|
SQLiteDatabase::SQLiteDatabase(const fs::path& dir_path, const fs::path& file_path, const DatabaseOptions& options, bool mock)
|
||||||
: WalletDatabase(), m_mock(mock), m_dir_path(fs::PathToString(dir_path)), m_file_path(fs::PathToString(file_path)), m_write_semaphore(1), m_use_unsafe_sync(options.use_unsafe_sync)
|
: WalletDatabase(), m_mock(mock), m_dir_path(dir_path), m_file_path(fs::PathToString(file_path)), m_write_semaphore(1), m_use_unsafe_sync(options.use_unsafe_sync)
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
LOCK(g_sqlite_mutex);
|
LOCK(g_sqlite_mutex);
|
||||||
LogPrintf("Using SQLite Version %s\n", SQLiteDatabaseVersion());
|
LogPrintf("Using SQLite Version %s\n", SQLiteDatabaseVersion());
|
||||||
LogPrintf("Using wallet %s\n", m_dir_path);
|
LogPrintf("Using wallet %s\n", fs::PathToString(m_dir_path));
|
||||||
|
|
||||||
if (++g_sqlite_count == 1) {
|
if (++g_sqlite_count == 1) {
|
||||||
// Setup logging
|
// Setup logging
|
||||||
@@ -253,7 +253,7 @@ void SQLiteDatabase::Open()
|
|||||||
|
|
||||||
if (m_db == nullptr) {
|
if (m_db == nullptr) {
|
||||||
if (!m_mock) {
|
if (!m_mock) {
|
||||||
TryCreateDirectories(fs::PathFromString(m_dir_path));
|
TryCreateDirectories(m_dir_path);
|
||||||
}
|
}
|
||||||
int ret = sqlite3_open_v2(m_file_path.c_str(), &m_db, flags, nullptr);
|
int ret = sqlite3_open_v2(m_file_path.c_str(), &m_db, flags, nullptr);
|
||||||
if (ret != SQLITE_OK) {
|
if (ret != SQLITE_OK) {
|
||||||
|
|||||||
+1
-1
@@ -104,7 +104,7 @@ class SQLiteDatabase : public WalletDatabase
|
|||||||
private:
|
private:
|
||||||
const bool m_mock{false};
|
const bool m_mock{false};
|
||||||
|
|
||||||
const std::string m_dir_path;
|
const fs::path m_dir_path;
|
||||||
|
|
||||||
const std::string m_file_path;
|
const std::string m_file_path;
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user