From c48cb57ce96c52350077b6710422fb072bd9f276 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Mon, 12 Nov 2012 18:37:37 +0000 Subject: enchanced database logging git-svn-id: http://svn.miranda-ng.org/main/trunk@2300 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/Db3x_mmap/src/dbsettings.cpp | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) (limited to 'plugins/Db3x_mmap/src/dbsettings.cpp') diff --git a/plugins/Db3x_mmap/src/dbsettings.cpp b/plugins/Db3x_mmap/src/dbsettings.cpp index 47bfef5e08..d648a5756f 100644 --- a/plugins/Db3x_mmap/src/dbsettings.cpp +++ b/plugins/Db3x_mmap/src/dbsettings.cpp @@ -99,15 +99,7 @@ int CDb3Base::GetContactSettingWorker(HANDLE hContact,DBCONTACTGETSETTING *dbcgs else memcpy( dbcgs->pValue, pCachedValue, sizeof( DBVARIANT )); - switch( dbcgs->pValue->type ) { - case DBVT_BYTE: log1( "get cached byte: %d", dbcgs->pValue->bVal ); break; - case DBVT_WORD: log1( "get cached word: %d", dbcgs->pValue->wVal ); break; - case DBVT_DWORD: log1( "get cached dword: %d", dbcgs->pValue->dVal ); break; - case DBVT_UTF8: - case DBVT_ASCIIZ: log1( "get cached string: '%s'", dbcgs->pValue->pszVal); break; - default: log1( "get cached crap: %d", dbcgs->pValue->type ); break; - } - + log1("get cached %s", printVariant(dbcgs->pValue)); return ( pCachedValue->type == DBVT_DELETED ) ? 1 : 0; } } @@ -416,10 +408,12 @@ 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); + if ( tmp.value.type != DBVT_BLOB ) { DBVARIANT* pCachedValue = m_cache->GetCachedValuePtr(hContact, szCachedSettingName, 1); if ( pCachedValue != NULL ) { - BOOL bIsIdentical = FALSE; + bool bIsIdentical = false; if ( pCachedValue->type == tmp.value.type ) { switch(tmp.value.type) { case DBVT_BYTE: bIsIdentical = pCachedValue->bVal == tmp.value.bVal; break; @@ -435,12 +429,15 @@ STDMETHODIMP_(BOOL) CDb3Base::WriteContactSetting(HANDLE hContact, DBCONTACTWRIT } if ( szCachedSettingName[-1] != 0 ) { lck.unlock(); + log1(" set resident as %s", printVariant(&tmp.value)); NotifyEventHooks(hSettingChangeEvent, (WPARAM)hContact, (LPARAM)&tmp); return 0; } } else m_cache->GetCachedValuePtr(hContact, szCachedSettingName, -1); + log1(" write database as %s", printVariant(&tmp.value)); + ofsModuleName = GetModuleNameOfs(tmp.szModule); if (hContact == 0) ofsContact = m_dbHeader.ofsUser; else ofsContact = (DWORD)hContact; @@ -449,7 +446,6 @@ STDMETHODIMP_(BOOL) CDb3Base::WriteContactSetting(HANDLE hContact, DBCONTACTWRIT if (dbc.signature != DBCONTACT_SIGNATURE) return 1; - log0("write setting"); //make sure the module group exists ofsSettingsGroup = GetSettingsGroupOfsByModuleNameOfs(&dbc,ofsContact,ofsModuleName); if (ofsSettingsGroup == 0) { //module group didn't exist - make it -- cgit v1.2.3