diff options
author | George Hazan <george.hazan@gmail.com> | 2015-03-12 23:01:42 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2015-03-12 23:01:42 +0000 |
commit | 3f4a9293edf07c4e8f3cd6ecfba2de9ed8afbdb3 (patch) | |
tree | 442309d8cb3a0a1980336464e57fd7891736e28e /plugins/Dbx_mdb/src/dbcontacts.cpp | |
parent | 8b151780697e8602c8064d032f86decdf581189b (diff) |
fix for the cursor scope
git-svn-id: http://svn.miranda-ng.org/main/trunk@12392 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/Dbx_mdb/src/dbcontacts.cpp')
-rw-r--r-- | plugins/Dbx_mdb/src/dbcontacts.cpp | 46 |
1 files changed, 24 insertions, 22 deletions
diff --git a/plugins/Dbx_mdb/src/dbcontacts.cpp b/plugins/Dbx_mdb/src/dbcontacts.cpp index 43296ff777..05d235c4e3 100644 --- a/plugins/Dbx_mdb/src/dbcontacts.cpp +++ b/plugins/Dbx_mdb/src/dbcontacts.cpp @@ -160,19 +160,20 @@ BOOL CDbxMdb::MetaMergeHistory(DBCachedContact *ccMeta, DBCachedContact *ccSub) MDB_val key = { sizeof(keyVal), &keyVal }, key2 = { sizeof(insVal), &insVal }, data;
txn_ptr 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) {
+ DBEventSortingKey *pKey = (DBEventSortingKey*)key.mv_data;
+ if (pKey->dwContactId != ccSub->contactID)
+ break;
- 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 != ccSub->contactID)
- break;
-
- insVal.ts = pKey->ts;
- insVal.dwEventId = pKey->dwEventId;
- mdb_put(trnlck, m_dbEventsSort, &key2, &data, 0);
+ insVal.ts = pKey->ts;
+ insVal.dwEventId = pKey->dwEventId;
+ mdb_put(trnlck, m_dbEventsSort, &key2, &data, 0);
- ccMeta->dbc.dwEventCount++;
+ ccMeta->dbc.dwEventCount++;
+ }
}
MDB_val keyc = { sizeof(int), &ccMeta->contactID }, datac = { sizeof(ccMeta->dbc), &ccMeta->dbc };
@@ -190,19 +191,20 @@ BOOL CDbxMdb::MetaSplitHistory(DBCachedContact *ccMeta, DBCachedContact *ccSub) MDB_val key = { sizeof(keyVal), &keyVal }, key2 = { sizeof(delVal), &delVal }, data;
txn_ptr 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) {
+ DBEventSortingKey *pKey = (DBEventSortingKey*)key.mv_data;
+ if (pKey->dwContactId != ccSub->contactID)
+ break;
- 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 != ccSub->contactID)
- break;
-
- delVal.ts = pKey->ts;
- delVal.dwEventId = pKey->dwEventId;
- mdb_del(trnlck, m_dbEventsSort, &key2, &data);
+ delVal.ts = pKey->ts;
+ delVal.dwEventId = pKey->dwEventId;
+ mdb_del(trnlck, m_dbEventsSort, &key2, &data);
- ccMeta->dbc.dwEventCount--;
+ ccMeta->dbc.dwEventCount--;
+ }
}
MDB_val keyc = { sizeof(int), &ccMeta->contactID }, datac = { sizeof(ccMeta->dbc), &ccMeta->dbc };
|