summaryrefslogtreecommitdiff
path: root/plugins/Dbx_mdbx/src
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2021-03-23 21:39:45 +0300
committerGeorge Hazan <ghazan@miranda.im>2021-03-23 21:39:45 +0300
commit42143e9cf3719630ab370e9369764cdaac892821 (patch)
tree0a7a1fb5f81b5baca71a7a44d04eab13b37a586a /plugins/Dbx_mdbx/src
parent607caf0454cda589ce0b84eb8d2c8e6b5613aec0 (diff)
fixes #2771 (Implement mdbx → sqlite converter)
Diffstat (limited to 'plugins/Dbx_mdbx/src')
-rw-r--r--plugins/Dbx_mdbx/src/init.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/plugins/Dbx_mdbx/src/init.cpp b/plugins/Dbx_mdbx/src/init.cpp
index 2741fe2341..cc9c47f265 100644
--- a/plugins/Dbx_mdbx/src/init.cpp
+++ b/plugins/Dbx_mdbx/src/init.cpp
@@ -74,9 +74,13 @@ static int grokHeader(const wchar_t *profile)
return db->Check();
}
-// returns 0 if all the APIs are injected otherwise, 1
+// returns a pointer to a database instance if all the APIs are injected, otherwise NULL
static MDatabaseCommon* loadDatabase(const wchar_t *profile, BOOL bReadOnly)
{
+ // if not read only, convert the old profile to SQLITE
+ if (!bReadOnly)
+ return DB::Upgrade(profile);
+
std::unique_ptr<CDbxMDBX> db(new CDbxMDBX(profile, (bReadOnly) ? DBMODE_READONLY : 0));
if (db->Map() != ERROR_SUCCESS)
return nullptr;