From a0a5ee70f1e5021df606a01a212144f4fe955daa Mon Sep 17 00:00:00 2001 From: George Hazan Date: Mon, 18 Jan 2021 21:57:04 +0300 Subject: fixes #2698 (Add current db format (mdbx, sqlite) to version info report) --- plugins/CrashDumper/src/dumper.cpp | 5 +++++ plugins/Db3x_mmap/src/dbintf.h | 2 ++ plugins/Db3x_mmap/src/init.cpp | 5 +++++ plugins/Dbx_mdbx/src/dbintf.h | 4 +++- plugins/Dbx_mdbx/src/init.cpp | 5 +++++ plugins/Dbx_sqlite/src/dbintf.h | 2 ++ plugins/Dbx_sqlite/src/main.cpp | 5 +++++ plugins/Import/src/dbrw/dbintf.h | 2 ++ plugins/Import/src/dbrw/dbrw.cpp | 5 +++++ plugins/Import/src/mcontacts.cpp | 7 +++++++ plugins/Import/src/patterns.cpp | 7 +++++++ plugins/Import/src/textjson.cpp | 7 +++++++ 12 files changed, 55 insertions(+), 1 deletion(-) (limited to 'plugins') diff --git a/plugins/CrashDumper/src/dumper.cpp b/plugins/CrashDumper/src/dumper.cpp index 99f4c801cb..fb1157d465 100644 --- a/plugins/CrashDumper/src/dumper.cpp +++ b/plugins/CrashDumper/src/dumper.cpp @@ -424,6 +424,11 @@ void PrintVersionInfo(CMStringW& buffer, unsigned flags) mir_snwprintf(profpn, L"%s\\%s", profpathfull, profname); buffer.AppendFormat(L"Profile: %s\r\n", profpn); + auto *pDb = db_get_current(); + if (pDb) + if (auto *dbLink = pDb->GetDriver()) + buffer.AppendFormat(L"Database driver: %s\r\n", dbLink ->szFullName); + if (flags & VI_FLAG_PRNVAR) { WIN32_FIND_DATA FindFileData; HANDLE hFind = FindFirstFile(profpn, &FindFileData); diff --git a/plugins/Db3x_mmap/src/dbintf.h b/plugins/Db3x_mmap/src/dbintf.h index 488e1c5ac0..8e09a9ba1c 100644 --- a/plugins/Db3x_mmap/src/dbintf.h +++ b/plugins/Db3x_mmap/src/dbintf.h @@ -242,6 +242,8 @@ public: STDMETHODIMP_(MEVENT) GetEventById(LPCSTR szModule, LPCSTR szId) override; + STDMETHODIMP_(DATABASELINK*) GetDriver() override; + protected: DWORD GetSettingsGroupOfsByModuleNameOfs(DBContact *dbc, DWORD ofsModuleName); void InvalidateSettingsGroupOfsCacheEntry(DWORD) {} diff --git a/plugins/Db3x_mmap/src/init.cpp b/plugins/Db3x_mmap/src/init.cpp index f43a620d62..5523236de0 100644 --- a/plugins/Db3x_mmap/src/init.cpp +++ b/plugins/Db3x_mmap/src/init.cpp @@ -134,6 +134,11 @@ static DATABASELINK dblink = LoadDatabase }; +STDMETHODIMP_(DATABASELINK *) CDb3Mmap::GetDriver() +{ + return &dblink; +} + ///////////////////////////////////////////////////////////////////////////////////////// int CMPlugin::Load() diff --git a/plugins/Dbx_mdbx/src/dbintf.h b/plugins/Dbx_mdbx/src/dbintf.h index 7fa524e302..67ccd62718 100644 --- a/plugins/Dbx_mdbx/src/dbintf.h +++ b/plugins/Dbx_mdbx/src/dbintf.h @@ -285,7 +285,9 @@ public: STDMETHODIMP_(BOOL) Backup(const wchar_t*); STDMETHODIMP_(MEVENT) GetEventById(const char *szModule, const char *szId) override; - + + STDMETHODIMP_(DATABASELINK*) GetDriver() override; + STDMETHODIMP_(DB::EventCursor *) EventCursor(MCONTACT hContact, MEVENT hDbEvent) override; STDMETHODIMP_(DB::EventCursor *) EventCursorRev(MCONTACT hContact, MEVENT hDbEvent) override; diff --git a/plugins/Dbx_mdbx/src/init.cpp b/plugins/Dbx_mdbx/src/init.cpp index 94e040a74f..a20c45320f 100644 --- a/plugins/Dbx_mdbx/src/init.cpp +++ b/plugins/Dbx_mdbx/src/init.cpp @@ -97,6 +97,11 @@ static DATABASELINK dblink = loadDatabase }; +STDMETHODIMP_(DATABASELINK *) CDbxMDBX::GetDriver() +{ + return &dblink; +} + int CMPlugin::Load() { mdbx_setup_debug(MDBX_LOG_WARN, MDBX_DBG_ASSERT, &logger); diff --git a/plugins/Dbx_sqlite/src/dbintf.h b/plugins/Dbx_sqlite/src/dbintf.h index 123f950e72..98b8765195 100755 --- a/plugins/Dbx_sqlite/src/dbintf.h +++ b/plugins/Dbx_sqlite/src/dbintf.h @@ -130,6 +130,8 @@ public: STDMETHODIMP_(BOOL) Compact() override; STDMETHODIMP_(BOOL) Backup(LPCWSTR) override; + STDMETHODIMP_(DATABASELINK*) GetDriver() override; + STDMETHODIMP_(DB::EventCursor*) EventCursor(MCONTACT hContact, MEVENT hDbEvent) override; STDMETHODIMP_(DB::EventCursor*) EventCursorRev(MCONTACT hContact, MEVENT hDbEvent) override; }; diff --git a/plugins/Dbx_sqlite/src/main.cpp b/plugins/Dbx_sqlite/src/main.cpp index 8b2c69cfb6..e3fe8b51d9 100644 --- a/plugins/Dbx_sqlite/src/main.cpp +++ b/plugins/Dbx_sqlite/src/main.cpp @@ -37,6 +37,11 @@ static DATABASELINK dblink = &CDbxSQLite::Load, }; +STDMETHODIMP_(DATABASELINK *) CDbxSQLite::GetDriver() +{ + return &dblink; +} + int CMPlugin::Load() { RegisterDatabasePlugin(&dblink); diff --git a/plugins/Import/src/dbrw/dbintf.h b/plugins/Import/src/dbrw/dbintf.h index 3c5fbef3c5..481ff173de 100644 --- a/plugins/Import/src/dbrw/dbintf.h +++ b/plugins/Import/src/dbrw/dbintf.h @@ -154,4 +154,6 @@ public: STDMETHODIMP_(BOOL) MetaSplitHistory(DBCachedContact *ccMeta, DBCachedContact *ccSub) override; STDMETHODIMP_(MEVENT) GetEventById(LPCSTR szModule, LPCSTR szId) override; + + STDMETHODIMP_(DATABASELINK *) GetDriver(); }; diff --git a/plugins/Import/src/dbrw/dbrw.cpp b/plugins/Import/src/dbrw/dbrw.cpp index a43f8da910..0779374d62 100644 --- a/plugins/Import/src/dbrw/dbrw.cpp +++ b/plugins/Import/src/dbrw/dbrw.cpp @@ -94,6 +94,11 @@ static DATABASELINK dblink = dbrw_Load }; +STDMETHODIMP_(DATABASELINK *) CDbxSQLite::GetDriver() +{ + return &g_patternDbLink; +} + void RegisterDbrw() { RegisterDatabasePlugin(&dblink); diff --git a/plugins/Import/src/mcontacts.cpp b/plugins/Import/src/mcontacts.cpp index 37e7a4f8a1..6764d9ae66 100644 --- a/plugins/Import/src/mcontacts.cpp +++ b/plugins/Import/src/mcontacts.cpp @@ -274,6 +274,8 @@ public: --m_curr; return *m_curr; } + + STDMETHODIMP_(DATABASELINK *) GetDriver() override; }; ///////////////////////////////////////////////////////////////////////////////////////// @@ -309,6 +311,11 @@ static DATABASELINK dblink = mc_load }; +STDMETHODIMP_(DATABASELINK *) CDbxMc::GetDriver() +{ + return &dblink; +} + void RegisterMContacts() { RegisterDatabasePlugin(&dblink); diff --git a/plugins/Import/src/patterns.cpp b/plugins/Import/src/patterns.cpp index 5fb789d26b..cdd69cdfeb 100644 --- a/plugins/Import/src/patterns.cpp +++ b/plugins/Import/src/patterns.cpp @@ -690,6 +690,8 @@ public: { return (idx >= 1) ? idx-1 : 0; } + + STDMETHODIMP_(DATABASELINK *) GetDriver(); }; ///////////////////////////////////////////////////////////////////////////////////////// @@ -723,3 +725,8 @@ DATABASELINK g_patternDbLink = pattern_grokHeader, pattern_load }; + +STDMETHODIMP_(DATABASELINK *) CDbxPattern::GetDriver() +{ + return &g_patternDbLink; +} diff --git a/plugins/Import/src/textjson.cpp b/plugins/Import/src/textjson.cpp index 81457ff2b9..b6f890c86b 100644 --- a/plugins/Import/src/textjson.cpp +++ b/plugins/Import/src/textjson.cpp @@ -207,6 +207,8 @@ public: return iEvent-1; } + + STDMETHODIMP_(DATABASELINK *) GetDriver(); }; static int mc_grokHeader(const wchar_t *profile) @@ -234,6 +236,11 @@ static DATABASELINK dblink = mc_load }; +STDMETHODIMP_(DATABASELINK *) CDbxJson::GetDriver() +{ + return &g_patternDbLink; +} + void RegisterJson() { RegisterDatabasePlugin(&dblink); -- cgit v1.2.3