mdb_set_dupsort function

int mdb_set_dupsort(
  1. Pointer<MDB_txn> txn,
  2. int dbi,
  3. Pointer<MDB_cmp_func> cmp
)

@brief 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 #mdb_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. @paramin txn A transaction handle returned by #mdb_txn_begin() @paramin dbi A database handle returned by #mdb_dbi_open() @paramin cmp A #MDB_cmp_func function @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<MDB_cmp_func>)>('mdb_set_dupsort')
external int mdb_set_dupsort(
  ffi.Pointer<MDB_txn> txn,
  int dbi,
  ffi.Pointer<MDB_cmp_func> cmp,
);