chickadee » lmdb-lolevel » mdb-set-dupsort

mdb-set-dupsort txn dbi cmpprocedure

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.

NOTE: This is not expected to be a scheme function, but a pointer to a C function. See the examples for a way to define a C comparison function.

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.

txn
A transaction handle returned by (mdb-txn-begin)
dbi
A database handle returned by (mdb-dbi-open)
cmp
A MDB_cmp_func function

Some possible error conditions:

(exn lmdb EINVAL)
an invalid parameter was specified.