Function lmdb_master_sys::mdb_cursor_open

source ·
pub unsafe extern "C" fn mdb_cursor_open(
    txn: *mut MDB_txn,
    dbi: MDB_dbi,
    cursor: *mut *mut MDB_cursor,
) -> c_int
Expand description

Create a cursor handle.

A cursor is associated with a specific transaction and database. A cursor cannot be used when its database handle is closed. Nor when its transaction has ended, except with #mdb_cursor_renew(). It can be discarded with #mdb_cursor_close(). A cursor in a write-transaction can be closed before its transaction ends, and will otherwise be closed when its transaction ends. A cursor in a read-only transaction must be closed explicitly, before or after its transaction ends. It can be reused with #mdb_cursor_renew() before finally closing it.

Note: Earlier documentation said that cursors in every transaction were closed when the transaction committed or aborted.

§Arguments

  • txn (direction in) - A transaction handle returned by #mdb_txn_begin()
  • dbi (direction in) - A database handle returned by #mdb_dbi_open()
  • cursor (direction out) - Address where the new #MDB_cursor handle will be stored

§Returns

A non-zero error value on failure and 0 on success. Some possible errors are:

  • EINVAL - an invalid parameter was specified.