From 7bb7189d67da6f916bbc9f4076d1319cd03f65d2 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Mon, 16 Nov 2020 20:17:27 +0300 Subject: Dbx_mdbx: global cursors replaced with mdbx_cursor_bind() and temporary cursors --- plugins/Dbx_mdbx/src/dbcontacts.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'plugins/Dbx_mdbx/src/dbcontacts.cpp') diff --git a/plugins/Dbx_mdbx/src/dbcontacts.cpp b/plugins/Dbx_mdbx/src/dbcontacts.cpp index 67e5d2be6f..0236a3ea08 100644 --- a/plugins/Dbx_mdbx/src/dbcontacts.cpp +++ b/plugins/Dbx_mdbx/src/dbcontacts.cpp @@ -149,9 +149,9 @@ void CDbxMDBX::GatherContactHistory(MCONTACT hContact, OBJLIST &list) MDBX_val key = { &keyVal, sizeof(keyVal) }, data; txn_ptr_ro trnlck(m_txn_ro); - cursor_ptr_ro cursor(m_curEventsSort); + mdbx_cursor_bind(m_txn_ro, m_curEventsSort, m_dbEventsSort); - for (int res = mdbx_cursor_get(cursor, &key, &data, MDBX_SET_RANGE); res == MDBX_SUCCESS; res = mdbx_cursor_get(cursor, &key, &data, MDBX_NEXT)) { + for (int res = mdbx_cursor_get(m_curEventsSort, &key, &data, MDBX_SET_RANGE); res == MDBX_SUCCESS; res = mdbx_cursor_get(m_curEventsSort, &key, &data, MDBX_NEXT)) { const DBEventSortingKey *pKey = (const DBEventSortingKey*)key.iov_base; if (pKey->hContact != hContact) return; @@ -286,10 +286,10 @@ void CDbxMDBX::FillContacts() { { txn_ptr_ro trnlck(m_txn_ro); - cursor_ptr_ro cursor(m_curContacts); + cursor_ptr pCursor(m_txn_ro, m_dbContacts); MDBX_val key, data; - while (mdbx_cursor_get(cursor, &key, &data, MDBX_NEXT) == MDBX_SUCCESS) { + while (mdbx_cursor_get(pCursor, &key, &data, MDBX_NEXT) == MDBX_SUCCESS) { DBCachedContact *cc = m_cache->AddContactToCache(*(MCONTACT*)key.iov_base); cc->dbc = *(DBContact*)data.iov_base; } -- cgit v1.2.3