From ea1df075f097abb0e787d93b671861fc212e315b Mon Sep 17 00:00:00 2001 From: pwm Date: Sat, 23 Jan 2016 17:26:28 +0100 Subject: [PATCH 1/2] Added missing cursor delete of current key/value pair. --- lmdb++.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/lmdb++.h b/lmdb++.h index 601568c..53fadf4 100644 --- a/lmdb++.h +++ b/lmdb++.h @@ -1893,6 +1893,16 @@ class lmdb::cursor { return found; } + /** + * Removes current key/value pair from this database. + * + * @param flags Allows MDB_NODUPDATA if the database was opened with MDB_DUPSORT + * @throws lmdb::error on failure + */ + void del(const unsigned int flags = 0) { + lmdb::cursor_del(handle(), flags); + } + /** * Positions this cursor at the given key. * From 502837688a95a5330b5acd547782d402b9a4d845 Mon Sep 17 00:00:00 2001 From: zyxxel Date: Sat, 23 Jan 2016 19:49:53 +0100 Subject: [PATCH 2/2] Non-template key-only dbi::get() since the templated version breaks use of lmdb::val parameter. --- lmdb++.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/lmdb++.h b/lmdb++.h index 53fadf4..3ff607e 100644 --- a/lmdb++.h +++ b/lmdb++.h @@ -1527,6 +1527,19 @@ class lmdb::dbi { return lmdb::dbi_get(txn, handle(), key, data); } + /** + * Retrieves a key from this database. + * + * @param txn a transaction handle + * @param key + * @throws lmdb::error on failure + */ + bool get(MDB_txn* const txn, + const val& key) const { + lmdb::val v{}; + return lmdb::dbi_get(txn, handle(), key, v); + } + /** * Retrieves a key from this database. *