mdb_cursor_open function

int mdb_cursor_open(
  1. Pointer<MDB_txn> txn,
  2. int dbi,
  3. Pointer<Pointer<MDB_cursor>> cursor
)

@brief 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. @paramin txn A transaction handle returned by #mdb_txn_begin() @paramin dbi A database handle returned by #mdb_dbi_open() @paramout cursor Address where the new #MDB_cursor handle will be stored @return A non-zero error value on failure and 0 on success. Some possible errors are:

  • EINVAL - an invalid parameter was specified.

Implementation

@ffi.FfiNative<
    ffi.Int Function(ffi.Pointer<MDB_txn>, MDB_dbi,
        ffi.Pointer<ffi.Pointer<MDB_cursor>>)>('mdb_cursor_open')
external int mdb_cursor_open(
  ffi.Pointer<MDB_txn> txn,
  int dbi,
  ffi.Pointer<ffi.Pointer<MDB_cursor>> cursor,
);