mirror of
https://github.com/isar/libmdbx.git
synced 2025-10-19 10:18:56 +08:00
mdbx: backport - Add MDB_PREV_MULTIPLE.
Logical counterpart to GET_MULTIPLE, NEXT_MULTIPLE Change-Id: I3f42cb1599997e79dbdc76bcf23b78314ededfc9
This commit is contained in:
22
mdb.c
22
mdb.c
@@ -6327,6 +6327,28 @@ fetchm:
|
||||
}
|
||||
}
|
||||
break;
|
||||
case MDB_PREV_MULTIPLE:
|
||||
if (data == NULL) {
|
||||
rc = EINVAL;
|
||||
break;
|
||||
}
|
||||
if (!(mc->mc_db->md_flags & MDB_DUPFIXED)) {
|
||||
rc = MDB_INCOMPATIBLE;
|
||||
break;
|
||||
}
|
||||
if (!(mc->mc_flags & C_INITIALIZED))
|
||||
rc = mdb_cursor_first(mc, key, data);
|
||||
else {
|
||||
MDB_cursor *mx = &mc->mc_xcursor->mx_cursor;
|
||||
if (mx->mc_flags & C_INITIALIZED) {
|
||||
rc = mdb_cursor_sibling(mx, 0);
|
||||
if (rc == MDB_SUCCESS)
|
||||
goto fetchm;
|
||||
} else {
|
||||
rc = MDB_NOTFOUND;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case MDB_NEXT:
|
||||
case MDB_NEXT_DUP:
|
||||
case MDB_NEXT_NODUP:
|
||||
|
Reference in New Issue
Block a user