summaryrefslogtreecommitdiff
path: root/plugins/Dbx_mdb/src/stdafx.h
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/Dbx_mdb/src/stdafx.h')
-rw-r--r--plugins/Dbx_mdb/src/stdafx.h23
1 files changed, 14 insertions, 9 deletions
diff --git a/plugins/Dbx_mdb/src/stdafx.h b/plugins/Dbx_mdb/src/stdafx.h
index 0a777f5e5b..793c25b6f0 100644
--- a/plugins/Dbx_mdb/src/stdafx.h
+++ b/plugins/Dbx_mdb/src/stdafx.h
@@ -79,22 +79,16 @@ public:
class txn_ptr_ro
{
- static MDB_txn *m_txn;
-
+ MDB_txn *m_txn;
public:
- __forceinline txn_ptr_ro(MDB_env *pEnv)
+ __forceinline txn_ptr_ro(MDB_txn *&txn) : m_txn(txn)
{
- if (!m_txn)
- mdb_txn_begin(pEnv, NULL, MDB_RDONLY, &m_txn);
- else
- mdb_txn_renew(m_txn);
+ mdb_txn_renew(m_txn);
}
-
__forceinline ~txn_ptr_ro()
{
mdb_txn_reset(m_txn);
}
-
__forceinline operator MDB_txn*() const { return m_txn; }
};
@@ -118,6 +112,17 @@ public:
__forceinline operator MDB_cursor*() const { return m_cursor; }
};
+class cursor_ptr_ro
+{
+ MDB_cursor *m_cursor;
+public:
+ __forceinline cursor_ptr_ro(MDB_cursor *&cursor) : m_cursor(cursor)
+ {
+ mdb_cursor_renew(mdb_cursor_txn(m_cursor), m_cursor); //--
+ }
+ __forceinline operator MDB_cursor*() const { return m_cursor; }
+};
+
#define MDB_CHECK(A,B) \
switch(A) { \
case MDB_SUCCESS: break; \