mirror of
https://github.com/isar/libmdbx.git
synced 2025-01-04 17:34:14 +08:00
mdbx: use MDBX_SET_LOWERBOUND
in mdbx_get_equal_or_great()
.
Change-Id: I5dd72fe82bd15938afc60cbc0f92e23c00f0d344
This commit is contained in:
parent
5e02e7fb56
commit
96c2a56aa1
15
src/core.c
15
src/core.c
@ -11733,20 +11733,7 @@ int mdbx_get_equal_or_great(MDBX_txn *txn, MDBX_dbi dbi, MDBX_val *key,
|
|||||||
if (unlikely(rc != MDBX_SUCCESS))
|
if (unlikely(rc != MDBX_SUCCESS))
|
||||||
return rc;
|
return rc;
|
||||||
|
|
||||||
MDBX_val save_data = *data;
|
return mdbx_cursor_get(&cx.outer, key, data, MDBX_SET_LOWERBOUND);
|
||||||
int exact = 0;
|
|
||||||
rc = mdbx_cursor_set(&cx.outer, key, data, MDBX_SET_RANGE, &exact);
|
|
||||||
if (unlikely(rc != MDBX_SUCCESS))
|
|
||||||
return rc;
|
|
||||||
|
|
||||||
if (exact && (txn->mt_dbs[dbi].md_flags & MDBX_DUPSORT) != 0) {
|
|
||||||
*data = save_data;
|
|
||||||
exact = 0;
|
|
||||||
rc = mdbx_cursor_set(&cx.outer, key, data, MDBX_GET_BOTH_RANGE, &exact);
|
|
||||||
if (unlikely(rc != MDBX_SUCCESS))
|
|
||||||
return rc;
|
|
||||||
}
|
|
||||||
return exact ? MDBX_SUCCESS : MDBX_RESULT_TRUE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int mdbx_get_ex(MDBX_txn *txn, MDBX_dbi dbi, MDBX_val *key, MDBX_val *data,
|
int mdbx_get_ex(MDBX_txn *txn, MDBX_dbi dbi, MDBX_val *key, MDBX_val *data,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user