diff options
author | MikalaiR <nikolay.romanovich@narod.ru> | 2016-02-18 12:32:59 +0000 |
---|---|---|
committer | MikalaiR <nikolay.romanovich@narod.ru> | 2016-02-18 12:32:59 +0000 |
commit | 2868202cb6260735157346833a4cf6326772011d (patch) | |
tree | 8bd251c1f657b3057975afee34055eba2c66f458 /plugins/Dbx_mdb/src/dbcontacts.cpp | |
parent | 73a0b84498501c1e2907f1cdc5f222f1f400edfd (diff) |
dbx_lmdb: speed optimization
git-svn-id: http://svn.miranda-ng.org/main/trunk@16301 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/Dbx_mdb/src/dbcontacts.cpp')
-rw-r--r-- | plugins/Dbx_mdb/src/dbcontacts.cpp | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/plugins/Dbx_mdb/src/dbcontacts.cpp b/plugins/Dbx_mdb/src/dbcontacts.cpp index 4bfec0261c..554df02d9a 100644 --- a/plugins/Dbx_mdb/src/dbcontacts.cpp +++ b/plugins/Dbx_mdb/src/dbcontacts.cpp @@ -104,6 +104,22 @@ STDMETHODIMP_(LONG) CDbxMdb::DeleteContact(MCONTACT contactID) if (trnlck.commit())
break;
}
+
+ DBEventSortingKey keyVal = { 0, 0, contactID };
+ key = { sizeof(keyVal), &keyVal }; MDB_val data;
+
+ txn_ptr trnlck(m_pMdbEnv, true);
+ cursor_ptr cursor(trnlck, m_dbEventsSort);
+ mdb_cursor_get(cursor, &key, &data, MDB_SET);
+ while (mdb_cursor_get(cursor, &key, &data, MDB_NEXT) == MDB_SUCCESS)
+ {
+ DBEventSortingKey *pKey = (DBEventSortingKey*)key.mv_data;
+ if (pKey->dwContactId != contactID)
+ return 0;
+
+ mdb_cursor_del(cursor, 0);
+ }
+
return 0;
}
@@ -159,7 +175,7 @@ void CDbxMdb::GatherContactHistory(MCONTACT hContact, LIST<EventItem> &list) DBEventSortingKey keyVal = { 0, 0, hContact };
MDB_val key = { sizeof(keyVal), &keyVal }, data;
- txn_ptr trnlck(m_pMdbEnv, true);
+ txn_ptr_ro trnlck(m_pMdbEnv);
cursor_ptr cursor(trnlck, m_dbEventsSort);
mdb_cursor_get(cursor, &key, &data, MDB_SET);
while (mdb_cursor_get(cursor, &key, &data, MDB_NEXT) == MDB_SUCCESS) {
|