pub unsafe extern "C" fn mdb_get(
txn: *mut MDB_txn,
dbi: MDB_dbi,
key: *mut MDB_val,
data: *mut MDB_val,
) -> c_int
Expand description
Get items from a database.
This function retrieves key/data pairs from the database. The address and length of the data associated with the specified key are returned in the structure to which data refers. If the database supports duplicate keys (#MDB_DUPSORT) then the first data item for the key will be returned. Retrieval of other items requires the use of #mdb_cursor_get().
Note: The memory pointed to by the returned values is owned by the database. The caller need not dispose of the memory, and may not modify it in any way. For values returned in a read-only transaction any modification attempts will cause a SIGSEGV. Note: Values returned from the database are valid only until a subsequent update operation, or the end of the transaction.
§Arguments
txn
(direction in) - A transaction handle returned by #mdb_txn_begin()dbi
(direction in) - A database handle returned by #mdb_dbi_open()key
(direction in) - The key to search for in the databasedata
(direction out) - The data corresponding to the key
§Returns
A non-zero error value on failure and 0 on success. Some possible errors are:
- #MDB_NOTFOUND - the key was not in the database.
- EINVAL - an invalid parameter was specified.