The name that the function will have in the database; this name defaults to the identifier of fun.
a delegate or function that implements the function. fun must satisfy these criteria:
Tells SQLite whether the result of the function is deterministic, i.e. if the result is the same when called with the same parameters. Recent versions of SQLite perform optimizations based on this. Set to Deterministic.no otherwise.
string fmt = "Hello, %s!"; string my_msg(string name) { return fmt.format(name); } auto db = Database(":memory:"); db.createFunction!"msg"(&my_msg); auto msg = db.execute("SELECT msg('John')").oneValue!string; assert(msg == "Hello, John!");
Creates and registers a new function in the database.
If a function with the same name and the same arguments already exists, it is replaced by the new one.
The memory associated with the function will be released when the database connection is closed.