mdbx: rework mdbx_dbi_open().

This commit is contained in:
Leo Yuriev
2017-05-15 21:18:52 +03:00
parent 5fdad46cb9
commit ed46246931
2 changed files with 116 additions and 150 deletions

52
mdbx.h
View File

@@ -1137,58 +1137,6 @@ LIBMDBX_API int mdbx_dbi_close(MDB_env *env, MDB_dbi dbi);
*/
LIBMDBX_API int mdbx_drop(MDB_txn *txn, MDB_dbi dbi, int del);
/* Set a custom key comparison function for a database.
*
* The comparison function is called whenever it is necessary to compare a
* key specified by the application with a key currently stored in the
*database.
* If no comparison function is specified, and no special key flags were
*specified
* with mdbx_dbi_open(), the keys are compared lexically, with shorter keys
*collating
* before longer keys.
* Warning: This function must be called before any data access functions are
*used,
* otherwise data corruption may occur. The same comparison function must be
*used by every
* program accessing the database, every time the database is used.
* [in] txn A transaction handle returned by mdbx_txn_begin()
* [in] dbi A database handle returned by mdbx_dbi_open()
* [in] cmp A MDB_cmp_func function
* Returns A non-zero error value on failure and 0 on success. Some possible
* errors are:
* - EINVAL - an invalid parameter was specified.
*/
LIBMDBX_API int mdbx_set_compare(MDB_txn *txn, MDB_dbi dbi, MDB_cmp_func *cmp);
/* Set a custom data comparison function for a MDB_DUPSORT database.
*
* This comparison function is called whenever it is necessary to compare a
*data
* item specified by the application with a data item currently stored in the
*database.
* This function only takes effect if the database was opened with the
*MDB_DUPSORT
* flag.
* If no comparison function is specified, and no special key flags were
*specified
* with mdbx_dbi_open(), the data items are compared lexically, with shorter
*items collating
* before longer items.
* Warning: This function must be called before any data access functions are
*used,
* otherwise data corruption may occur. The same comparison function must be
*used by every
* program accessing the database, every time the database is used.
* [in] txn A transaction handle returned by mdbx_txn_begin()
* [in] dbi A database handle returned by mdbx_dbi_open()
* [in] cmp A MDB_cmp_func function
* Returns A non-zero error value on failure and 0 on success. Some possible
* errors are:
* - EINVAL - an invalid parameter was specified.
*/
LIBMDBX_API int mdbx_set_dupsort(MDB_txn *txn, MDB_dbi dbi, MDB_cmp_func *cmp);
/* Get items from a database.
*
* This function retrieves key/data pairs from the database. The address