An alias to the D implementation of the function. The function fun must satisfy these criteria:
The name that the function will have in the database; this name defaults to the identifier of fun.
static int my_collation(string s1, string s2) { import std.uni; return icmp(s1, s2); } auto db = Database(":memory:"); db.createCollation!"my_coll"(&my_collation); db.execute("CREATE TABLE test (word TEXT)"); auto statement = db.prepare("INSERT INTO test (word) VALUES (?)"); foreach (word; ["straße", "strasses"]) { statement.bind(1, word); statement.execute(); statement.reset(); } auto word = db.execute("SELECT word FROM test ORDER BY word COLLATE my_coll") .oneValue!string; assert(word == "straße");
Creates and registers a collation function in the database.