Function lmdb_master_sys::mdb_del

source ·
pub unsafe extern "C" fn mdb_del(
    txn: *mut MDB_txn,
    dbi: MDB_dbi,
    key: *mut MDB_val,
    data: *mut MDB_val,
) -> c_int
Expand description

Delete items from a database.

This function removes key/data pairs from the database. If the database does not support sorted duplicate data items (#MDB_DUPSORT) the data parameter is ignored. If the database supports sorted duplicates and the data parameter is NULL, all of the duplicate data items for the key will be deleted. Otherwise, if the data parameter is non-NULL only the matching data item will be deleted. This function will return #MDB_NOTFOUND if the specified key/data pair is not in the database.

§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 delete from the database
  • data (direction in) - The data to delete

§Returns

A non-zero error value on failure and 0 on success. Some possible errors are:

  • EACCES - an attempt was made to write in a read-only transaction.
  • EINVAL - an invalid parameter was specified.