forked from ermine/sulci
-
Notifications
You must be signed in to change notification settings - Fork 0
/
sqlgg_traits.ml
53 lines (40 loc) · 1.25 KB
/
sqlgg_traits.ml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
(** *)
module type M = sig
type statement
type connection
type params
type row
type result
(** datatypes *)
type num = int64
type text = string
type any = text
exception Oops of string
val get_column_Int : row -> int -> num
val get_column_Text : row -> int -> text
val get_column_Any : row -> int -> any
val start_params : statement -> int -> params
val finish_params : params -> result
(** [set_param_* stmt index val]. [index] is 0-based,
@raise Oops on error *)
val set_param_null : params -> int -> unit
val set_param_Text : params -> int -> text -> unit
val set_param_Any : params -> int -> any -> unit
val set_param_Int : params -> int -> num -> unit
val no_params : statement -> result
(**
Perform query and return results via callback for each row
@raise Oops on error
*)
val select : connection -> string -> (statement -> result) -> (row -> unit) -> unit
(**
Perform query and return first row if available
@raise Oops on error
*)
val select1 : connection -> string -> (statement -> result) -> (row -> 'b) -> 'b option
(** Execute non-query.
@raise Oops on error
@return number of affected rows
*)
val execute : connection -> string -> (statement -> result) -> int64
end