[prev in list] [next in list] [prev in thread] [next in thread] 

List:       openldap-technical
Subject:    Re: LMDB cursor position
From:       M Gurschi <max.gurschi () gmail ! com>
Date:       2024-02-02 15:15:41
Message-ID: 33BFBFFD-71DC-4655-9615-C68DD94663D0 () gmail ! com
[Download RAW message or body]

...in addition,

Can i rely that for both:
*mdb_cursor_get(key, data, MDB_SET_RANGE)*
and
*mdb_cursor_get(key, data, MDB_NEXT)*

, if the call returns *MDB_NOTFOUND*, then the key i passed in the call will be left \
unmodified?

Kind Regards,
Maxim Gurschi

On 2 Feb 2024, at 11:23, M Gurschi <max.gurschi@gmail.com> wrote:

Hello Howard,

Tell me please, after *mdb_cursor_get(key, data, MDB_SET_RANGE)*, if i want to \
consume the key, if i understand correctly the key will be updated (on success). Will \
                the reference to data also be updated or do i need to do:
*mdb_cursor_get(key, data, MDB_GET_CURRENT)* to get data to point at the data from \
the key?

Kind Regards,
Maxim Gurschi

On 1 Feb 2024, at 20:21, M Gurschi <max.gurschi@gmail.com> wrote:

Understood, thank you!

Kind Regards,
Maxim Gurschi

On 1 Feb 2024, at 17:53, Howard Chu <hyc@symas.com> wrote:

M Gurschi wrote:
> Hello team,
> 
> Can you please let me know, when using *mdb_cursor_get* with *MDB_SET* operation, \
> in case the key is not present in the db, where is the cursor left pointing? 
> My scenario is that i want to retrieve two adjacent keys.
> 
> 1. first *mdb_cursor_get* with *MDB_SET* 
> 2. after that, *mdb_cursor_get* with *MDB_NEXT* 
> 
> I'm wondering what can i expect the cursor to point at in case the key is not found \
> in step 1.

You cannot expect anything in particular.

Use MDB_SET_RANGE instead.

-- 
-- Howard Chu
CTO, Symas Corp.           http://www.symas.com
Director, Highland Sun     http://highlandsun.com/hyc/
Chief Architect, OpenLDAP  http://www.openldap.org/project/


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic