diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2016-02-20 11:29:30 +0100 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2016-02-20 11:29:30 +0100 |
commit | d89c27c9a1cc4d2c4ea806d71653e32c2891077b (patch) | |
tree | 1bae2be5286e281c946b425b05346f7966c4cc6e /common/storage_lmdb.cpp | |
parent | a4cf8be92253d1696a8907da85b1b6a8f5d4ad05 (diff) | |
download | sink-d89c27c9a1cc4d2c4ea806d71653e32c2891077b.tar.gz sink-d89c27c9a1cc4d2c4ea806d71653e32c2891077b.zip |
Get substring matches to work with sorted duplicates in store
Diffstat (limited to 'common/storage_lmdb.cpp')
-rw-r--r-- | common/storage_lmdb.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/common/storage_lmdb.cpp b/common/storage_lmdb.cpp index 8cb965f..2d8b187 100644 --- a/common/storage_lmdb.cpp +++ b/common/storage_lmdb.cpp | |||
@@ -224,7 +224,12 @@ int Storage::NamedDatabase::scan(const QByteArray &k, | |||
224 | if (QByteArray::fromRawData((char*)key.mv_data, key.mv_size).startsWith(k)) { | 224 | if (QByteArray::fromRawData((char*)key.mv_data, key.mv_size).startsWith(k)) { |
225 | numberOfRetrievedValues++; | 225 | numberOfRetrievedValues++; |
226 | if (resultHandler(QByteArray::fromRawData((char*)key.mv_data, key.mv_size), QByteArray::fromRawData((char*)data.mv_data, data.mv_size))) { | 226 | if (resultHandler(QByteArray::fromRawData((char*)key.mv_data, key.mv_size), QByteArray::fromRawData((char*)data.mv_data, data.mv_size))) { |
227 | MDB_cursor_op nextOp = d->allowDuplicates ? MDB_NEXT_DUP : MDB_NEXT; | 227 | if (findSubstringKeys) { |
228 | //Reset the key to what we search for | ||
229 | key.mv_data = (void*)k.constData(); | ||
230 | key.mv_size = k.size(); | ||
231 | } | ||
232 | MDB_cursor_op nextOp = (d->allowDuplicates && !findSubstringKeys) ? MDB_NEXT_DUP : MDB_NEXT; | ||
228 | while ((rc = mdb_cursor_get(cursor, &key, &data, nextOp)) == 0) { | 233 | while ((rc = mdb_cursor_get(cursor, &key, &data, nextOp)) == 0) { |
229 | //Every consequent lookup simply iterates through the list | 234 | //Every consequent lookup simply iterates through the list |
230 | if (QByteArray::fromRawData((char*)key.mv_data, key.mv_size).startsWith(k)) { | 235 | if (QByteArray::fromRawData((char*)key.mv_data, key.mv_size).startsWith(k)) { |