diff options
author | MikalaiR <nikolay.romanovich@narod.ru> | 2016-02-20 12:48:13 +0000 |
---|---|---|
committer | MikalaiR <nikolay.romanovich@narod.ru> | 2016-02-20 12:48:13 +0000 |
commit | d363c51d46ee4cd1775ea5b28a50b80175e25dcc (patch) | |
tree | 633673262bd2cbf8dfbd2010ce8cc99b2711626a /plugins/Dbx_mdb/src/dbevents.cpp | |
parent | f764743b3f58209720f3c9d97884f05eed642150 (diff) |
dbx_lmdb: speed optimization
git-svn-id: http://svn.miranda-ng.org/main/trunk@16314 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/Dbx_mdb/src/dbevents.cpp')
-rw-r--r-- | plugins/Dbx_mdb/src/dbevents.cpp | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/plugins/Dbx_mdb/src/dbevents.cpp b/plugins/Dbx_mdb/src/dbevents.cpp index 39ec4d4afb..0214a3f2d8 100644 --- a/plugins/Dbx_mdb/src/dbevents.cpp +++ b/plugins/Dbx_mdb/src/dbevents.cpp @@ -23,8 +23,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "stdafx.h"
-MDB_txn* txn_ptr_ro::m_txn;
-
STDMETHODIMP_(LONG) CDbxMdb::GetEventCount(MCONTACT contactID)
{
DBCachedContact *cc = m_cache->GetCachedContact(contactID);
@@ -188,7 +186,7 @@ STDMETHODIMP_(BOOL) CDbxMdb::DeleteEvent(MCONTACT contactID, MEVENT hDbEvent) STDMETHODIMP_(LONG) CDbxMdb::GetBlobSize(MEVENT hDbEvent)
{
mir_cslock lck(m_csDbAccess);
- txn_ptr_ro txn(m_pMdbEnv);
+ txn_ptr_ro txn(m_txn);
MDB_val key = { sizeof(MEVENT), &hDbEvent }, data;
if (mdb_get(txn, m_dbEvents, &key, &data) != MDB_SUCCESS)
@@ -207,7 +205,7 @@ STDMETHODIMP_(BOOL) CDbxMdb::GetEvent(MEVENT hDbEvent, DBEVENTINFO *dbei) }
mir_cslock lck(m_csDbAccess);
- txn_ptr_ro txn(m_pMdbEnv);
+ txn_ptr_ro txn(m_txn);
MDB_val key = { sizeof(MEVENT), &hDbEvent }, data;
if (mdb_get(txn, m_dbEvents, &key, &data) != MDB_SUCCESS)
@@ -307,7 +305,7 @@ STDMETHODIMP_(MCONTACT) CDbxMdb::GetEventContact(MEVENT hDbEvent) if (hDbEvent == 0) return INVALID_CONTACT_ID;
mir_cslock lck(m_csDbAccess);
- txn_ptr_ro txn(m_pMdbEnv);
+ txn_ptr_ro txn(m_txn);
MDB_val key = { sizeof(MEVENT), &hDbEvent }, data;
if (mdb_get(txn, m_dbEvents, &key, &data) != MDB_SUCCESS)
@@ -323,9 +321,9 @@ STDMETHODIMP_(MEVENT) CDbxMdb::FindFirstEvent(MCONTACT contactID) MDB_val key = { sizeof(keyVal), &keyVal }, data;
mir_cslock lck(m_csDbAccess);
- txn_ptr_ro txn(m_pMdbEnv);
+ txn_ptr_ro txn(m_txn);
- cursor_ptr cursor(txn, m_dbEventsSort);
+ cursor_ptr_ro cursor(m_curEventsSort);
mdb_cursor_get(cursor, &key, &data, MDB_SET);
if (mdb_cursor_get(cursor, &key, &data, MDB_NEXT) != MDB_SUCCESS)
return m_evLast = 0;
@@ -347,9 +345,9 @@ STDMETHODIMP_(MEVENT) CDbxMdb::FindLastEvent(MCONTACT contactID) MDB_val key = { sizeof(keyVal), &keyVal }, data;
mir_cslock lck(m_csDbAccess);
- txn_ptr_ro txn(m_pMdbEnv);
+ txn_ptr_ro txn(m_txn);
- cursor_ptr cursor(txn, m_dbEventsSort);
+ cursor_ptr_ro cursor(m_curEventsSort);
mdb_cursor_get(cursor, &key, &data, MDB_SET);
if (mdb_cursor_get(cursor, &key, &data, MDB_PREV) != MDB_SUCCESS)
return m_evLast = 0;
@@ -367,7 +365,7 @@ STDMETHODIMP_(MEVENT) CDbxMdb::FindNextEvent(MCONTACT contactID, MEVENT hDbEvent DWORD ts;
mir_cslock lck(m_csDbAccess);
- txn_ptr_ro txn(m_pMdbEnv);
+ txn_ptr_ro txn(m_txn);
if (m_evLast != hDbEvent) {
MDB_val key = { sizeof(MEVENT), &hDbEvent };
@@ -380,7 +378,7 @@ STDMETHODIMP_(MEVENT) CDbxMdb::FindNextEvent(MCONTACT contactID, MEVENT hDbEvent DBEventSortingKey keyVal = { hDbEvent, ts, contactID };
MDB_val key = { sizeof(keyVal), &keyVal };
- cursor_ptr cursor(txn, m_dbEventsSort);
+ cursor_ptr_ro cursor(m_curEventsSort);
if (mdb_cursor_get(cursor, &key, &data, MDB_SET) != MDB_SUCCESS)
return m_evLast = 0;
@@ -400,7 +398,7 @@ STDMETHODIMP_(MEVENT) CDbxMdb::FindPrevEvent(MCONTACT contactID, MEVENT hDbEvent DWORD ts;
mir_cslock lck(m_csDbAccess);
- txn_ptr_ro txn(m_pMdbEnv);
+ txn_ptr_ro txn(m_txn);
if (m_evLast != hDbEvent) {
MDB_val key = { sizeof(MEVENT), &hDbEvent };
@@ -413,7 +411,7 @@ STDMETHODIMP_(MEVENT) CDbxMdb::FindPrevEvent(MCONTACT contactID, MEVENT hDbEvent DBEventSortingKey keyVal = { hDbEvent, ts, contactID };
MDB_val key = { sizeof(keyVal), &keyVal };
- cursor_ptr cursor(txn, m_dbEventsSort);
+ cursor_ptr_ro cursor(m_curEventsSort);
if (mdb_cursor_get(cursor, &key, &data, MDB_SET) != MDB_SUCCESS)
return m_evLast = 0;
|