summaryrefslogtreecommitdiff
path: root/plugins/Dbx_mdb/src/stdafx.h
diff options
context:
space:
mode:
authorMikalaiR <nikolay.romanovich@narod.ru>2016-02-19 15:39:36 +0000
committerMikalaiR <nikolay.romanovich@narod.ru>2016-02-19 15:39:36 +0000
commitbb9b9046f5749d13f83b3c2fe8a47b6d3fd6994e (patch)
tree16042555d69124dab843d8719c6b1cc93b5a7e4d /plugins/Dbx_mdb/src/stdafx.h
parentcf751286442fa9b4b4843ae1091625e6a6c7ba2d (diff)
dbx_lmdb: speed optimization
git-svn-id: http://svn.miranda-ng.org/main/trunk@16311 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/Dbx_mdb/src/stdafx.h')
-rw-r--r--plugins/Dbx_mdb/src/stdafx.h22
1 files changed, 20 insertions, 2 deletions
diff --git a/plugins/Dbx_mdb/src/stdafx.h b/plugins/Dbx_mdb/src/stdafx.h
index 0a777f5e5b..3f193dda47 100644
--- a/plugins/Dbx_mdb/src/stdafx.h
+++ b/plugins/Dbx_mdb/src/stdafx.h
@@ -50,9 +50,9 @@ class txn_ptr
MDB_txn *m_txn;
public:
- __forceinline txn_ptr(MDB_env *pEnv, bool bReadOnly = false)
+ __forceinline txn_ptr(MDB_env *pEnv)
{
- mdb_txn_begin(pEnv, NULL, (bReadOnly) ? MDB_RDONLY : 0, &m_txn);
+ mdb_txn_begin(pEnv, NULL, 0, &m_txn);
}
__forceinline ~txn_ptr()
@@ -118,6 +118,24 @@ public:
__forceinline operator MDB_cursor*() const { return m_cursor; }
};
+class cursor_ptr_ro
+{
+ static MDB_cursor *m_cursor;
+
+public:
+ __forceinline cursor_ptr_ro(MDB_txn *_txn, MDB_dbi _dbi)
+ {
+ if (!m_cursor)
+ mdb_cursor_open(_txn, _dbi, &m_cursor);
+ }
+
+ __forceinline ~cursor_ptr_ro()
+ {
+ }
+
+ __forceinline operator MDB_cursor*() const { return m_cursor; }
+};
+
#define MDB_CHECK(A,B) \
switch(A) { \
case MDB_SUCCESS: break; \