directory-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Alex Karasulu" <aok...@bellsouth.net>
Subject [rms] Getting the last value of a key with duplicates
Date Tue, 20 Apr 2004 04:00:49 GMT
Hi,

I have been looking through the docs for a way to advance to the last 
value of a key's values where the database allows duplicates.

Is there a way to do this?  I saw getLast but this is 
to advance the cursor to the last value of the entire DB.
I just need to advance to the last value of a key.

The only way I can think of doing this is to advance the cursor to 
the key.  Take one step forward w/o duplicates passing all duplicates in 
the key.  The take one step back with duplicates which should take me 
back to the last value I'm looking for in the key.  Here's what this
"work around" looks like:

Looking for last value of key '2' which is 'c' in this example:

1). Advance to key '2'
    -----
    |1-a|
 -->|2-b|
    |2-c|
    |3-d|
    |3-e|
    -----
2). Step forward one step w/o dups
    -----
    |1-a|
    |2-b|
    |2-c|
 -->|3-d|
    |3-e|
    -----
3). Step back one step with dups
    -----
    |1-a|
    |2-b|
 -->|2-c|
    |3-d|
    |3-e|
    -----

Have not tried this yet but I used to use this technique with the old 
bdb.  I'm wondering if things have changed any in JE to do this with 
less effort.

Thanks,
Alex




Mime
View raw message