summaryrefslogtreecommitdiff
path: root/plugins/Dbx_mdb/src/dbcontacts.cpp
diff options
context:
space:
mode:
authorMikalaiR <nikolay.romanovich@narod.ru>2016-04-24 13:40:50 +0000
committerMikalaiR <nikolay.romanovich@narod.ru>2016-04-24 13:40:50 +0000
commitc831d41181f53d00debc5c725459f90ce25716f2 (patch)
tree2f763de6a0c6890653c1b7fe838e4976d7ad2bc8 /plugins/Dbx_mdb/src/dbcontacts.cpp
parent0080cd035eaa00062b5f0f494be1e8862d8548b7 (diff)
dbx_lmdb: updated lmdb engine
git-svn-id: http://svn.miranda-ng.org/main/trunk@16761 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/Dbx_mdb/src/dbcontacts.cpp')
-rw-r--r--plugins/Dbx_mdb/src/dbcontacts.cpp29
1 files changed, 13 insertions, 16 deletions
diff --git a/plugins/Dbx_mdb/src/dbcontacts.cpp b/plugins/Dbx_mdb/src/dbcontacts.cpp
index c77eb3dfba..68a063519e 100644
--- a/plugins/Dbx_mdb/src/dbcontacts.cpp
+++ b/plugins/Dbx_mdb/src/dbcontacts.cpp
@@ -113,16 +113,14 @@ STDMETHODIMP_(LONG) CDbxMdb::DeleteContact(MCONTACT contactID)
key.mv_size = sizeof(keyS); key.mv_data = &keyS;
- if (mdb_cursor_get(cursor, &key, &data, MDB_SET_RANGE) == MDB_SUCCESS)
+ for (int res = mdb_cursor_get(cursor, &key, &data, MDB_SET_RANGE); res == MDB_SUCCESS; res = mdb_cursor_get(cursor, &key, &data, MDB_NEXT))
{
- do
- {
- const DBSettingKey *pKey = (const DBSettingKey*)key.mv_data;
- if (pKey->dwContactID != contactID)
- break;
- mdb_cursor_del(cursor, 0);
- } while (mdb_cursor_get(cursor, &key, &data, MDB_NEXT) == MDB_SUCCESS);
+ const DBSettingKey *pKey = (const DBSettingKey*)key.mv_data;
+ if (pKey->dwContactID != contactID)
+ break;
+ mdb_cursor_del(cursor, 0);
}
+
txn.commit();
}
@@ -199,15 +197,14 @@ void CDbxMdb::GatherContactHistory(MCONTACT hContact, LIST<EventItem> &list)
txn_ptr_ro trnlck(m_txn);
cursor_ptr_ro cursor(m_curEventsSort);
- if (mdb_cursor_get(cursor, &key, &data, MDB_SET_RANGE) == MDB_SUCCESS)
+
+ for (int res = mdb_cursor_get(cursor, &key, &data, MDB_SET_RANGE); res == MDB_SUCCESS; res = mdb_cursor_get(cursor, &key, &data, MDB_NEXT))
{
- do {
- const DBEventSortingKey *pKey = (const DBEventSortingKey*)key.mv_data;
- if (pKey->dwContactId != hContact)
- return;
+ const DBEventSortingKey *pKey = (const DBEventSortingKey*)key.mv_data;
+ if (pKey->dwContactId != hContact)
+ return;
- list.insert(new EventItem(pKey->ts, pKey->dwEventId));
- } while (mdb_cursor_get(cursor, &key, &data, MDB_NEXT) == MDB_SUCCESS);
+ list.insert(new EventItem(pKey->ts, pKey->dwEventId));
}
}
@@ -321,7 +318,7 @@ void CDbxMdb::FillContacts()
cursor_ptr_ro cursor(m_curContacts);
MDB_val key, data;
- while (mdb_cursor_get(cursor, &key, &data, MDB_NEXT) == 0)
+ while (mdb_cursor_get(cursor, &key, &data, MDB_NEXT) == MDB_SUCCESS)
{
const DBContact *dbc = (const DBContact*)data.mv_data;
if (dbc->dwSignature != DBCONTACT_SIGNATURE)