mdbx: MDBX_EMULTIVAL errcode for libfpta.

This commit is contained in:
Leo Yuriev 2017-01-24 15:38:20 +03:00
parent 688b711e31
commit 8b045ab626
3 changed files with 4 additions and 2 deletions

2
mdb.c
View File

@ -9254,7 +9254,7 @@ mdb_put(MDB_txn *txn, MDB_dbi dbi,
MDB_node *leaf = NODEPTR(mc.mc_pg[mc.mc_top], mc.mc_ki[mc.mc_top]); MDB_node *leaf = NODEPTR(mc.mc_pg[mc.mc_top], mc.mc_ki[mc.mc_top]);
if (F_ISSET(leaf->mn_flags, F_DUPDATA)) { if (F_ISSET(leaf->mn_flags, F_DUPDATA)) {
mdb_tassert(txn, XCURSOR_INITED(&mc) && mc.mc_xcursor->mx_db.md_entries > 1); mdb_tassert(txn, XCURSOR_INITED(&mc) && mc.mc_xcursor->mx_db.md_entries > 1);
rc = MDB_KEYEXIST; rc = MDBX_EMULTIVAL;
} }
} }
} }

2
mdbx.c
View File

@ -468,7 +468,7 @@ int mdbx_replace(MDB_txn *txn, MDB_dbi dbi,
MDB_node *leaf = NODEPTR(page, mc.mc_ki[mc.mc_top]); MDB_node *leaf = NODEPTR(page, mc.mc_ki[mc.mc_top]);
if (F_ISSET(leaf->mn_flags, F_DUPDATA)) { if (F_ISSET(leaf->mn_flags, F_DUPDATA)) {
mdb_tassert(txn, XCURSOR_INITED(&mc) && mc.mc_xcursor->mx_db.md_entries > 1); mdb_tassert(txn, XCURSOR_INITED(&mc) && mc.mc_xcursor->mx_db.md_entries > 1);
rc = MDB_KEYEXIST; rc = MDBX_EMULTIVAL;
goto bailout; goto bailout;
} }
/* если данные совпадают, то ничего делать не надо */ /* если данные совпадают, то ничего делать не надо */

2
mdbx.h
View File

@ -223,6 +223,8 @@ size_t mdbx_canary_get(MDB_txn *txn, mdbx_canary* canary);
* 0 otherwise or less that zero in error case. */ * 0 otherwise or less that zero in error case. */
int mdbx_cursor_eof(MDB_cursor *mc); int mdbx_cursor_eof(MDB_cursor *mc);
#define MDBX_EMULTIVAL (MDB_LAST_ERRCODE - 42)
int mdbx_replace(MDB_txn *txn, MDB_dbi dbi, int mdbx_replace(MDB_txn *txn, MDB_dbi dbi,
MDB_val *key, MDB_val *new_data, MDB_val *old_data, unsigned flags); MDB_val *key, MDB_val *new_data, MDB_val *old_data, unsigned flags);
/* Same as mdbx_get(), but also return the count /* Same as mdbx_get(), but also return the count