ml traits: execute returns number of affected rows
[sqlgg.git] / impl / sqlgg_traits.ml
blob79fa95d8893b30eb52c73c27e5d012dc57808ddf
1 (** *)
3 module type M = sig
5 type statement
6 type connection
7 type params
8 type row
9 type result
11 (** datatypes *)
12 type num = int64
13 type text = string
14 type any = text
16 exception Oops of string
18 val get_column_Int : row -> int -> num
19 val get_column_Text : row -> int -> text
20 val get_column_Any : row -> int -> any
22 val start_params : statement -> int -> params
23 val finish_params : params -> result
25 (** [set_param_* stmt index val]. [index] is 0-based,
26 @raise Oops on error *)
27 val set_param_null : params -> int -> unit
28 val set_param_Text : params -> int -> text -> unit
29 val set_param_Any : params -> int -> any -> unit
30 val set_param_Int : params -> int -> num -> unit
32 val no_params : statement -> result
34 (**
35 Perform query and return results via callback for each row
36 @raise Oops on error
38 val select : connection -> string -> (statement -> result) -> (row -> unit) -> unit
40 (**
41 Perform query and return first row if available
42 @raise Oops on error
44 val select1 : connection -> string -> (statement -> result) -> (row -> 'b) -> 'b option
46 (** Execute non-query.
47 @raise Oops on error
48 @return number of affected rows
50 val execute : connection -> string -> (statement -> result) -> int64
52 end