Related issue: mdb_cursor_prev/mdb_cursor_last() with data==NULL position the xcursor at 1st data item, while data!=NULL puts it at last item.
That's unintuitive and should either be documented or normalized - but changing it can break existing programs. In the cases when it didn't just fail earlier, anyway: mdb_cursor_prev(), and maybe mdb_cursor_last() on a sub-DB. Haven't tested the latter. Whatever mdb_cursor_last() ends up doing, I think mdb_cursor_prev() should do the same. There is positioning code inside if(data) elsewhere too, but defaults to doing cursor_first() or something similar. Don't know if that can have any visible effect on the next operation. -- Hallvard