Hi all!
Is there a way to iterate with all key-value pairs in LMDB database, where all keys is in specified range? I'm trying to use mdb_cursor_get() with MDB_SET_RANGE to search first pair. Then I see only one way - use mdb_cursor_get() with MDB_NEXT and compare key by memcmp(). But it seems absolutely not effective.
Is there another solution for my task?
Thanks!
On Mon, May 4, 2015 at 9:31 PM, Александр Киранов xhaskx@gmail.com wrote:
Is there a way to iterate with all key-value pairs in LMDB database, where all keys is in specified range? I'm trying to use mdb_cursor_get() with MDB_SET_RANGE to search first pair. Then I see only one way - use mdb_cursor_get() with MDB_NEXT and compare key by memcmp(). But it seems absolutely not effective.
Is there another solution for my task?
Instead of memcmp(), you'd probably want to use mdb_cmp() for the key comparison:
http://symas.com/mdb/doc/group__mdb.html#gaba790a2493f744965b810efac73bac0e
Александр Киранов wrote:
Hi all!
Is there a way to iterate with all key-value pairs in LMDB database, where all keys is in specified range? I'm trying to use mdb_cursor_get() with MDB_SET_RANGE to search first pair.
Right.
Then I see only one way - use mdb_cursor_get() with MDB_NEXT and compare key by memcmp().
For strict correctness you should be using mdb_cmp().
But it seems absolutely not effective.
I have no idea what that sentence means. What actual problem do you have?
Is there another solution for my task?
Thanks!
openldap-technical@openldap.org