package fun-sqlite

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

Use this module for SQLite database queries.

include Fun_sql.Sql with type db = Sqlite3.db
type db = Sqlite3.db
type arg
type _ ret
val placeholder : Stdlib.Format.formatter -> int -> unit
val query : db -> string -> ?args:arg list -> 'r ret -> 'r
val exec_script : db -> string -> unit
module Arg : sig ... end
type row
val unit : unit ret
val ret : (row -> 'a) -> 'a Stdlib.Seq.t ret
val int : int -> row -> int
val bool : int -> row -> bool
val int64 : int -> row -> int64
val float : int -> row -> float
val text : int -> row -> string
val opt : (int -> row -> 'a) -> int -> row -> 'a option
include Fun_sql.S with type db := db and type arg := arg and type 'a ret := 'a ret
val sql : ('a, Stdlib.Format.formatter, unit, string) Stdlib.format4 -> 'a
exception Bad_migration of string
val migrate : db -> string -> unit
val transaction : db -> (unit -> 'r) -> 'r
exception More_than_one
val only : 'a Stdlib.Seq.t -> 'a
val optional : 'a Stdlib.Seq.t -> 'a option
val batch_insert : db -> string -> 'a list -> ('a -> arg list) -> 'r ret -> 'r

batch_insert db sql objs obj_args ret inserts into the database db, running the query sql, the row tuples obtained by encoding the list of objs using the obj_args function.

This prepares a new statement each time because the VALUES (...) clause may contain different numbers of placeholders in each call.

The return type of the query is decoded by ret.

OCaml

Innovation. Community. Security.