package ezsqlite

  1. Overview
  2. Docs
Simplified SQLite3 bindings for OCaml

Install

Dune Dependency

Authors

Maintainers

Sources

0.3.tar.gz
sha256=e90d7fb0e82a552b853803bf45208ddbe1dd2ce4a53882888273f936b41ad202
md5=cffc08cb6f1fe46dca694a2ae1bcce97

doc/ezsqlite/Ezsqlite/index.html

Module Ezsqlite

exception Sqlite_error of string
module Value : sig ... end
type t

sqlite3 handle

val load : string -> t

Load database from file

val auto_extension : (t -> unit) -> unit
val commit_hook : (unit -> int) -> unit
val update_hook : (int -> string -> string -> int64 -> unit) -> unit
val create_function : t -> string -> int -> (Value.value array -> Value.value) -> unit
type stmt

sqlite3_stmt handle

val prepare : t -> string -> stmt

Prepare an SQL statement

val reset : stmt -> unit

Reset a statement -- this does not unbind bound values

val clear : stmt -> unit

Reset and clear bindings

val bind : stmt -> int -> Value.value -> unit
val bind_dict : stmt -> (string * Value.value) list -> unit
val bind_list : stmt -> Value.value list -> unit
val parameter_count : stmt -> int

Get the number of parameters

val parameter_index : stmt -> string -> int

Get the index of a named parameter

val text : stmt -> int -> string
val blob : stmt -> int -> Bytes.t
val int64 : stmt -> int -> int64
val int : stmt -> int -> int
val double : stmt -> int -> float
val column : stmt -> int -> Value.value

Get a value by index

val exec : stmt -> unit

Execute a statement that returns no response

val step : stmt -> bool
val iter : stmt -> (stmt -> unit) -> unit

Iterate over each step

val map : stmt -> (stmt -> 'a) -> 'a list

Iterate over each step returning a value each time

val fold : stmt -> (stmt -> 'a -> 'a) -> 'a -> 'a

Fold a function over each step returning a single accumulated value

val run : t -> string -> ?bind:Value.value list -> (stmt -> 'a) -> 'a list

Convert a string into a statement and execute it

val run_ign : t -> string -> ?bind:Value.value list -> unit -> unit
val data : stmt -> Value.value array

Get each column as an array

val dict : stmt -> (string * Value.value) list

Get each column as a list of tuples mapping from string to value

val column_type : stmt -> int -> Value.kind

Get a value's type by index

val data_count : stmt -> int

Get the number of columns with data

val database_name : stmt -> int -> string

Get the name of the database a statement is attached to

val table_name : stmt -> int -> string

Get the name of a table a statement is attached to

val origin_name : stmt -> int -> string

Get the name of a column a statement value is bound to

val column_name : stmt -> int -> string
val dump_sql : t -> string -> string
module Backup : sig ... end
module Blob : sig ... end
module Infix : sig ... end
OCaml

Innovation. Community. Security.