summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2021-01-18 21:57:04 +0300
committerGeorge Hazan <ghazan@miranda.im>2021-01-18 21:57:04 +0300
commita0a5ee70f1e5021df606a01a212144f4fe955daa (patch)
tree5a2e33c2f6b1481318f11a9c38e0732cb53be802
parent007d5cd3398c7e82a5bbfe29131323c7c2ea379b (diff)
fixes #2698 (Add current db format (mdbx, sqlite) to version info report)
-rw-r--r--include/m_db_int.h6
-rw-r--r--plugins/CrashDumper/src/dumper.cpp5
-rw-r--r--plugins/Db3x_mmap/src/dbintf.h2
-rw-r--r--plugins/Db3x_mmap/src/init.cpp5
-rw-r--r--plugins/Dbx_mdbx/src/dbintf.h4
-rw-r--r--plugins/Dbx_mdbx/src/init.cpp5
-rwxr-xr-xplugins/Dbx_sqlite/src/dbintf.h2
-rw-r--r--plugins/Dbx_sqlite/src/main.cpp5
-rw-r--r--plugins/Import/src/dbrw/dbintf.h2
-rw-r--r--plugins/Import/src/dbrw/dbrw.cpp5
-rw-r--r--plugins/Import/src/mcontacts.cpp7
-rw-r--r--plugins/Import/src/patterns.cpp7
-rw-r--r--plugins/Import/src/textjson.cpp7
13 files changed, 60 insertions, 2 deletions
diff --git a/include/m_db_int.h b/include/m_db_int.h
index ab17c39088..198f21a030 100644
--- a/include/m_db_int.h
+++ b/include/m_db_int.h
@@ -37,6 +37,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define STATUS_FATAL 3
#define STATUS_SUCCESS 4
+struct DATABASELINK;
+
struct DBCHeckCallback
{
DWORD spaceProcessed, spaceUsed;
@@ -155,6 +157,8 @@ interface MIR_APP_EXPORT MIDatabase
STDMETHOD_(BOOL, Backup)(LPCWSTR) PURE;
STDMETHOD_(MIDatabaseChecker*, GetChecker)(void) PURE;
+ STDMETHOD_(DATABASELINK*, GetDriver)(void) PURE;
+
STDMETHOD_(MEVENT, GetEventById)(LPCSTR szModule, LPCSTR szId) PURE;
@@ -181,7 +185,7 @@ protected:
mir_cs m_csDbAccess;
LIST<char> m_lResidentSettings;
MIDatabaseCache* m_cache;
- MICryptoEngine *m_crypto;
+ MICryptoEngine *m_crypto = nullptr;
protected:
int CheckProto(DBCachedContact *cc, const char *proto);
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);