Hello,
I'm trying to make a cursor that iterates on records with duplicate
keys, but in reverse order.
I've noticed there's DB_NEXT_DUP, but there's no DB_PREV_DUP flag for
Dbc->get method.
Is there a solution ?
Also, there's no flag for join cursor to iterate backwards.
Any ideas ?
At present, the only way to achieve this is to use DB_PREV and check
whether the key has changed.
There is code to do this in the Java API in
java/src/com/sleepycat/db/Cursor.java, in the getPrevDup method. It's
probably more complicated than you need because it makes sure that the
cursor doesn't move on error.
There is no way to go backwards with a join cursor.
If you always want to iterate backwards, you could specify a duplicate
comparison function that orders the duplicates the way you want.