summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2012-11-12 19:41:26 +0000
committerGeorge Hazan <george.hazan@gmail.com>2012-11-12 19:41:26 +0000
commit1f55192138ca303dc1082f90bda17af26ae699b2 (patch)
tree7942a141699bd03fa82c497186d6fa31cf838a85
parent162b511678264424af0d5c19166858012b142ac1 (diff)
enchanced database logging
git-svn-id: http://svn.miranda-ng.org/main/trunk@2302 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
-rw-r--r--plugins/Db3x_mmap/src/database.cpp11
-rw-r--r--plugins/Db3x_mmap/src/dbsettings.cpp11
2 files changed, 11 insertions, 11 deletions
diff --git a/plugins/Db3x_mmap/src/database.cpp b/plugins/Db3x_mmap/src/database.cpp
index c9a4793c0f..684ed9d903 100644
--- a/plugins/Db3x_mmap/src/database.cpp
+++ b/plugins/Db3x_mmap/src/database.cpp
@@ -128,12 +128,13 @@ char* printVariant(DBVARIANT* p)
static char boo[1000];
switch (p->type) {
- case DBVT_BYTE: mir_snprintf(boo, sizeof(boo), "byte: %d", p->bVal ); break;
- case DBVT_WORD: mir_snprintf(boo, sizeof(boo), "word: %d", p->wVal ); break;
- case DBVT_DWORD: mir_snprintf(boo, sizeof(boo), "dword: %d", p->dVal ); break;
+ case DBVT_BYTE: mir_snprintf(boo, sizeof(boo), "byte: %d", p->bVal ); break;
+ case DBVT_WORD: mir_snprintf(boo, sizeof(boo), "word: %d", p->wVal ); break;
+ case DBVT_DWORD: mir_snprintf(boo, sizeof(boo), "dword: %d", p->dVal ); break;
case DBVT_UTF8:
- case DBVT_ASCIIZ: mir_snprintf(boo, sizeof(boo), "string: '%s'", p->pszVal); break;
- default: mir_snprintf(boo, sizeof(boo), "crap: %d", p->type ); break;
+ case DBVT_ASCIIZ: mir_snprintf(boo, sizeof(boo), "string: '%s'", p->pszVal); break;
+ case DBVT_DELETED: strcpy(boo, "deleted"); break;
+ default: mir_snprintf(boo, sizeof(boo), "crap: %d", p->type ); break;
}
return boo;
}
diff --git a/plugins/Db3x_mmap/src/dbsettings.cpp b/plugins/Db3x_mmap/src/dbsettings.cpp
index d648a5756f..bd93a0ffa0 100644
--- a/plugins/Db3x_mmap/src/dbsettings.cpp
+++ b/plugins/Db3x_mmap/src/dbsettings.cpp
@@ -69,9 +69,8 @@ int CDb3Base::GetContactSettingWorker(HANDLE hContact,DBCONTACTGETSETTING *dbcgs
mir_cslock lck(m_csDbAccess);
- log3("get [%08p] %s/%s",hContact,dbcgs->szModule,dbcgs->szSetting);
-
szCachedSettingName = m_cache->GetCachedSetting(dbcgs->szModule,dbcgs->szSetting,moduleNameLen,settingNameLen);
+ log3("get [%08p] %s (%p)", hContact, szCachedSettingName, szCachedSettingName);
{
DBVARIANT* pCachedValue = m_cache->GetCachedValuePtr(hContact, szCachedSettingName, 0);
if ( pCachedValue != NULL ) {
@@ -99,7 +98,7 @@ int CDb3Base::GetContactSettingWorker(HANDLE hContact,DBCONTACTGETSETTING *dbcgs
else
memcpy( dbcgs->pValue, pCachedValue, sizeof( DBVARIANT ));
- log1("get cached %s", printVariant(dbcgs->pValue));
+ log2("get cached %s (%p)", printVariant(dbcgs->pValue), pCachedValue);
return ( pCachedValue->type == DBVT_DELETED ) ? 1 : 0;
} }
@@ -408,10 +407,10 @@ STDMETHODIMP_(BOOL) CDb3Base::WriteContactSetting(HANDLE hContact, DBCONTACTWRIT
mir_cslockfull lck(m_csDbAccess);
char* szCachedSettingName = m_cache->GetCachedSetting(tmp.szModule, tmp.szSetting, moduleNameLen, settingNameLen);
- log2("[%08x] write setting '%s'", hContact, szCachedSettingName);
+ log3("set [%08p] %s (%p)", hContact, szCachedSettingName, szCachedSettingName);
if ( tmp.value.type != DBVT_BLOB ) {
- DBVARIANT* pCachedValue = m_cache->GetCachedValuePtr(hContact, szCachedSettingName, 1);
+ DBVARIANT *pCachedValue = m_cache->GetCachedValuePtr(hContact, szCachedSettingName, 1);
if ( pCachedValue != NULL ) {
bool bIsIdentical = false;
if ( pCachedValue->type == tmp.value.type ) {
@@ -429,7 +428,7 @@ STDMETHODIMP_(BOOL) CDb3Base::WriteContactSetting(HANDLE hContact, DBCONTACTWRIT
}
if ( szCachedSettingName[-1] != 0 ) {
lck.unlock();
- log1(" set resident as %s", printVariant(&tmp.value));
+ log2(" set resident as %s (%p)", printVariant(&tmp.value), pCachedValue);
NotifyEventHooks(hSettingChangeEvent, (WPARAM)hContact, (LPARAM)&tmp);
return 0;
}