chickadee » lmdb-lolevel » mdb-set-compare

mdb-set-compare txn dbi cmpprocedure

Set a custom key comparison function for a database.

The comparison function is called whenever it is necessary to compare a key specified by the application with a key currently stored in the database. If no comparison function is specified, and no special key flags were specified with (mdb-dbi-open), the keys are compared lexically, with shorter keys collating before longer keys.

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.

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

Some possible error conditions:

(exn lmdb EINVAL)
an invalid parameter was specified.