chickadee » lmdb-lolevel » mdb-dbi-open

mdb-dbi-open txn name flagsprocedure

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.

A transaction handle returned by (mdb-txn-begin)
The name of the database to open. If only a single database is needed in the environment, this value may be #f
Special options for this database. This parameter must be set to 0 or by bitwise OR'ing together (using the bitwise-ior procedure) one or more of the values described in the 'Database Flags' section in Contants.

Some possible error conditions:

(exn lmdb MDB_NOTFOUND)
the specified database doesn't exist in the environment and MDB_CREATE was not specified.
(exn lmdb MDB_DBS_FULL)
too many databases have been opened. See (mdb-env-set-maxdbs).