chickadee » sqlite3 » define-collation

define-collation DATABASE NAME #!optional PROCprocedure

If a procedure is given, registers a new collation sequence identified by name for use in the context of database handle db. If no procedure is passed, the collation sequence with the given name is removed.

PROC should have the signature (PROC STRING STRING) => FIXNUM. It should return a negative number if the first argument sorts before the second, a positive number if the second sorts before the first and zero if they are equal.

As PROC will be called in a callback context from within step!, safety measures are installed to avoid throwing any exceptions, invoking continuations or returning invalid values from it. Attempts to do so will result in a 0 return value and warning messages.