summaryrefslogtreecommitdiff
path: root/plugins/Dbx_mdbx/src/init.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/Dbx_mdbx/src/init.cpp')
-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;