diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2018-05-24 12:24:46 +0200 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2018-05-24 12:26:04 +0200 |
commit | 44d77a4e65dcc5d79a1e924a139ec65a9a1e8f9d (patch) | |
tree | 9600b0d44ebdaa442af3cffa693e10ec6b232cee | |
parent | 0456cef80e909e545897ac9eb107fd832d4dfde8 (diff) | |
download | sink-44d77a4e65dcc5d79a1e924a139ec65a9a1e8f9d.tar.gz sink-44d77a4e65dcc5d79a1e924a139ec65a9a1e8f9d.zip |
Return number of retrieved values.
-rw-r--r-- | common/storage_lmdb.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
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 | |||
595 | return 0; | 595 | return 0; |
596 | } | 596 | } |
597 | 597 | ||
598 | int count = 0; | ||
598 | do { | 599 | do { |
599 | const auto currentBAKey = QByteArray::fromRawData((char *)currentKey.mv_data, currentKey.mv_size); | 600 | const auto currentBAKey = QByteArray::fromRawData((char *)currentKey.mv_data, currentKey.mv_size); |
600 | const auto currentBAValue = QByteArray::fromRawData((char *)data.mv_data, data.mv_size); | 601 | const auto currentBAValue = QByteArray::fromRawData((char *)data.mv_data, data.mv_size); |
601 | resultHandler(currentBAKey, currentBAValue); | 602 | resultHandler(currentBAKey, currentBAValue); |
603 | count++; | ||
602 | } while (mdb_cursor_get(cursor, ¤tKey, &data, MDB_NEXT) == MDB_SUCCESS && | 604 | } while (mdb_cursor_get(cursor, ¤tKey, &data, MDB_NEXT) == MDB_SUCCESS && |
603 | mdb_cmp(d->transaction, d->dbi, ¤tKey, &idealLastKey) <= 0); | 605 | mdb_cmp(d->transaction, d->dbi, ¤tKey, &idealLastKey) <= 0); |
604 | 606 | ||
605 | mdb_cursor_close(cursor); | 607 | mdb_cursor_close(cursor); |
608 | return count; | ||
606 | } | 609 | } |
607 | 610 | ||
608 | qint64 DataStore::NamedDatabase::getSize() | 611 | qint64 DataStore::NamedDatabase::getSize() |