From 8e5ea02989638819f7d1400047561023a42309f8 Mon Sep 17 00:00:00 2001 From: Martchus Date: Tue, 19 Apr 2022 00:20:27 +0200 Subject: [PATCH] Delete indexes as well when deleting via iterator --- lmdb-typed.hh | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lmdb-typed.hh b/lmdb-typed.hh index b04c21f..c84285b 100644 --- a/lmdb-typed.hh +++ b/lmdb-typed.hh @@ -441,7 +441,14 @@ public: void del() { - d_cursor.del(); + auto id = this->getID(); + auto &value = this->value(); + if (d_on_index) { + (*d_parent->d_txn)->del(d_parent->d_parent->d_main, d_data); + } else { + d_cursor.del(); + } + d_parent->d_parent->forEachIndex([&](auto &&i) { i.del(*d_parent->d_txn, value, id); }); } bool operator!=(const eiter_t &) const