package sqlite3

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type

Create user-defined aggregate and window functions.

Aggregate functions provide the step function, which is called once per value being added to the aggregate, and the final function is called once to return the final value.

To make a window function (requires SQLite3 3.25 or newer; on older versions a normal aggregate function is created), the additional inverse function, which removes a value from the window, and value, which can be called many times and returns the current computed value of the window, must both be included.

val create_fun0 : ?inverse:('a -> 'a) -> ?value:('a -> Data.t) -> db -> string -> init:'a -> step:('a -> 'a) -> final:('a -> Data.t) -> unit

create_fun0 ?inverse ?value db name ~init ~step ~final registers the step and finalizer functions and optional inverse and value functions under name name with database handle db. This function has arity 0.

  • raises SqliteError

    if an invalid database handle is passed.

val create_fun1 : ?inverse:('a -> Data.t -> 'a) -> ?value:('a -> Data.t) -> db -> string -> init:'a -> step:('a -> Data.t -> 'a) -> final:('a -> Data.t) -> unit

create_fun1 ?inverse ?value db name ~init ~step ~final registers the step and finalizer functions and optional inverse and value functions under name name with database handle db. This function has arity 1.

  • raises SqliteError

    if an invalid database handle is passed.

val create_fun2 : ?inverse:('a -> Data.t -> Data.t -> 'a) -> ?value:('a -> Data.t) -> db -> string -> init:'a -> step:('a -> Data.t -> Data.t -> 'a) -> final:('a -> Data.t) -> unit

create_fun2 ?inverse ?value db name ~init ~step ~final registers the step and finalizer functions and optional inverse and value functions under name name with database handle db. This function has arity 2.

  • raises SqliteError

    if an invalid database handle is passed.

val create_fun3 : ?inverse:('a -> Data.t -> Data.t -> Data.t -> 'a) -> ?value:('a -> Data.t) -> db -> string -> init:'a -> step:('a -> Data.t -> Data.t -> Data.t -> 'a) -> final:('a -> Data.t) -> unit

create_fun3 ?inverse ?value db name ~init ~step ~final registers the step and finalizer functions and optional inverse and value functions under name name with database handle db. This function has arity 3.

  • raises SqliteError

    if an invalid database handle is passed.

val create_funN : ?inverse:('a -> Data.t array -> 'a) -> ?value:('a -> Data.t) -> db -> string -> init:'a -> step:('a -> Data.t array -> 'a) -> final:('a -> Data.t) -> unit

create_funN ?inverse ?value db name ~init ~step ~final registers the step and finalizer functions and optional inverse and value functions under name name with database handle db. This function has arity N.

  • raises SqliteError

    if an invalid database handle is passed.