pub unsafe extern "C" fn mdb_dbi_open(
txn: *mut MDB_txn,
name: *const c_char,
flags: c_uint,
dbi: *mut MDB_dbi,
) -> c_int
Expand description
@brief Open a database in the environment.
A database handle denotes the name and parameters of a database, independently of whether such a database exists. The database handle may be discarded by calling #mdb_dbi_close(). The old database handle is returned if the database was already open. The handle may only be closed once.
The database handle will be private to the current transaction until the transaction is successfully committed. If the transaction is aborted the handle will be closed automatically. After a successful commit the handle will reside in the shared environment, and may be used by other transactions.
This function must not be called from multiple concurrent transactions in the same process. A transaction that uses this function must finish (either commit or abort) before any other transaction in the process may use this function.
To use named databases (with name != NULL), #mdb_env_set_maxdbs() must be called before opening the environment. Database names are keys in the unnamed database, and may be read but not written.
@param[in] txn A transaction handle returned by #mdb_txn_begin() @param[in] name The name of the database to open. If only a single database is needed in the environment, this value may be NULL. @param[in] flags Special options for this database. This parameter must be set to 0 or by bitwise OR’ing together one or more of the values described here.
- #MDB_REVERSEKEY Keys are strings to be compared in reverse order, from the end of the strings to the beginning. By default, Keys are treated as strings and compared from beginning to end.
- #MDB_DUPSORT Duplicate keys may be used in the database. (Or, from another perspective, keys may have multiple data items, stored in sorted order.) By default keys must be unique and may have only a single data item.
- #MDB_INTEGERKEY Keys are binary integers in native byte order, either unsigned int or size_t, and will be sorted as such. The keys must all be of the same size.
- #MDB_DUPFIXED This flag may only be used in combination with #MDB_DUPSORT. This option tells the library that the data items for this database are all the same size, which allows further optimizations in storage and retrieval. When all data items are the same size, the #MDB_GET_MULTIPLE, #MDB_NEXT_MULTIPLE and #MDB_PREV_MULTIPLE cursor operations may be used to retrieve multiple items at once.
- #MDB_INTEGERDUP This option specifies that duplicate data items are binary integers, similar to #MDB_INTEGERKEY keys.
- #MDB_REVERSEDUP This option specifies that duplicate data items should be compared as strings in reverse order.
- #MDB_CREATE Create the named database if it doesn't exist. This option is not allowed in a read-only transaction or a read-only environment.
- #MDB_NOTFOUND - the specified database doesn't exist in the environment and #MDB_CREATE was not specified.
- #MDB_DBS_FULL - too many databases have been opened. See #mdb_env_set_maxdbs().