mdbx: don't ignore data arg in mdb_del() for libfpta.

This commit is contained in:
Leo Yuriev 2017-02-02 13:15:16 +03:00
parent c9b7c0f4d1
commit 4681620e66
2 changed files with 11 additions and 1 deletions

10
lmdb.h
View File

@ -1,7 +1,7 @@
/** @file lmdb.h /** @file lmdb.h
* @brief Extended Lightning memory-mapped database library * @brief Extended Lightning memory-mapped database library
* *
* @mainpage Extended Lightning Memory-Mapped Database Manager (MDBX) * @mainpage Extended Lightning Memory-Mapped Database (MDBX)
* *
* @section intro_sec Introduction * @section intro_sec Introduction
* MDBX is a Btree-based database management library modeled loosely on the * MDBX is a Btree-based database management library modeled loosely on the
@ -1387,12 +1387,20 @@ int mdb_put(MDB_txn *txn, MDB_dbi dbi, MDB_val *key, MDB_val *data,
/** @brief Delete items from a database. /** @brief Delete items from a database.
* *
* This function removes key/data pairs from the database. * This function removes key/data pairs from the database.
*
* MDBX-mode:
* The data parameter is NOT ignored regardless the database does
* support sorted duplicate data items or not. If the data parameter
* is non-NULL only the matching data item will be deleted.
*
* LMDB-compatible mode:
* If the database does not support sorted duplicate data items * If the database does not support sorted duplicate data items
* (#MDB_DUPSORT) the data parameter is ignored. * (#MDB_DUPSORT) the data parameter is ignored.
* If the database supports sorted duplicates and the data parameter * If the database supports sorted duplicates and the data parameter
* is NULL, all of the duplicate data items for the key will be * is NULL, all of the duplicate data items for the key will be
* deleted. Otherwise, if the data parameter is non-NULL * deleted. Otherwise, if the data parameter is non-NULL
* only the matching data item will be deleted. * only the matching data item will be deleted.
*
* This function will return #MDB_NOTFOUND if the specified key/data * This function will return #MDB_NOTFOUND if the specified key/data
* pair is not in the database. * pair is not in the database.
* @param[in] txn A transaction handle returned by #mdb_txn_begin() * @param[in] txn A transaction handle returned by #mdb_txn_begin()

2
mdb.c
View File

@ -8773,10 +8773,12 @@ mdb_del(MDB_txn *txn, MDB_dbi dbi,
if (unlikely(txn->mt_flags & (MDB_TXN_RDONLY|MDB_TXN_BLOCKED))) if (unlikely(txn->mt_flags & (MDB_TXN_RDONLY|MDB_TXN_BLOCKED)))
return (txn->mt_flags & MDB_TXN_RDONLY) ? EACCES : MDB_BAD_TXN; return (txn->mt_flags & MDB_TXN_RDONLY) ? EACCES : MDB_BAD_TXN;
#if ! MDBX_MODE_ENABLED
if (!F_ISSET(txn->mt_dbs[dbi].md_flags, MDB_DUPSORT)) { if (!F_ISSET(txn->mt_dbs[dbi].md_flags, MDB_DUPSORT)) {
/* must ignore any data */ /* must ignore any data */
data = NULL; data = NULL;
} }
#endif
return mdb_del0(txn, dbi, key, data, 0); return mdb_del0(txn, dbi, key, data, 0);
} }