Make.SqlA generic way to write placeholders for different database drivers' prepared statement parameters.
ℹ️ Placeholders are 0-indexed.
The main function through which queries are run is the query function. This function always creates a prepared statement for each partial call to query db sql. This prepared statement can then be called with the actual arguments (if any) and the resultset row decoder:
let add_person =
query db (sql "insert into people (name, age) values (%a, %a)" placeholder 0 placeholder 1)
let add_person name age = add_person Arg.[text name; int age] unitval exec_script : db -> string -> unitexec_script db sql executes the sql script (possibly made up of multiple statements) in the database db. Note that it ignores any rows returned by any of the statements.
The script must not have a trailing semicolon.
These encode OCaml data as data to be bound to the query statement.
module Arg : sig ... endval int : int -> row -> intval bool : int -> row -> boolval int64 : int -> row -> int64val float : int -> row -> floatval text : int -> row -> stringAlso handles values of all other types. Use this when SQLite can change the exact type of value it returns at runtime, e.g. for very large numbers it can return text.