From 44d77a4e65dcc5d79a1e924a139ec65a9a1e8f9d Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Thu, 24 May 2018 12:24:46 +0200 Subject: Return number of retrieved values. --- common/storage_lmdb.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/common/storage_lmdb.cpp b/common/storage_lmdb.cpp index 4ac5724..2f6e7e1 100644 --- a/common/storage_lmdb.cpp +++ b/common/storage_lmdb.cpp @@ -595,14 +595,17 @@ int DataStore::NamedDatabase::findAllInRange(const QByteArray &lowerBound, const return 0; } + int count = 0; do { const auto currentBAKey = QByteArray::fromRawData((char *)currentKey.mv_data, currentKey.mv_size); const auto currentBAValue = QByteArray::fromRawData((char *)data.mv_data, data.mv_size); resultHandler(currentBAKey, currentBAValue); + count++; } while (mdb_cursor_get(cursor, ¤tKey, &data, MDB_NEXT) == MDB_SUCCESS && mdb_cmp(d->transaction, d->dbi, ¤tKey, &idealLastKey) <= 0); mdb_cursor_close(cursor); + return count; } qint64 DataStore::NamedDatabase::getSize() -- cgit v1.2.3