createFunction method

void createFunction({
  1. required String functionName,
  2. required ScalarFunction function,
  3. required int argumentCount,
  4. bool deterministic = false,
  5. bool directOnly = true,
})

Creater a custom callback function.

The function will get a list of objects as argument. It needs to be of the form:

(args) { return yourValue; } The deterministic flag (defaults to false) can be set to indicate that the function always gives the same output when the input parameters are the same (for optimization). The directOnly flag (defaults to true) is a security measure. When enabled, the function may only be invoked form top-level SQL, and cannot be used in VIEWs or TRIGGERs nor in schema structures (such as CHECK, DEFAULT, etc.).

Implementation

void createFunction({
  required String functionName,
  required ScalarFunction function,
  required int argumentCount,
  bool deterministic = false,
  bool directOnly = true,
}) {
  checkOpen();
  _db?.createFunction(
    functionName: functionName,
    argumentCount: AllowedArgumentCount(argumentCount),
    deterministic: deterministic,
    directOnly: directOnly,
    function: function,
  );
}