sig
  type date = { year : int; month : int; day : int; }
  type time = {
    hour : int;
    min : int;
    sec : int;
    microsec : int;
    timezone : int option;
  }
  type datetime = Dbi.date * Dbi.time
  module Decimal :
    sig
      type t
      val to_string : Dbi.Decimal.t -> string
      val to_float : Dbi.Decimal.t -> float
      val of_string : ?scale:int -> string -> Dbi.Decimal.t
      val of_int : ?scale:int -> int -> Dbi.Decimal.t
      val add : Dbi.Decimal.t -> Dbi.Decimal.t -> Dbi.Decimal.t
      val sub : Dbi.Decimal.t -> Dbi.Decimal.t -> Dbi.Decimal.t
      val mul : Dbi.Decimal.t -> Dbi.Decimal.t -> Dbi.Decimal.t
      val div : Dbi.Decimal.t -> Dbi.Decimal.t -> Dbi.Decimal.t
      val compare : Dbi.Decimal.t -> Dbi.Decimal.t -> int
    end
  type sql_t =
      [ `Bigint of Big_int.big_int
      | `Binary of string
      | `Bool of bool
      | `Date of Dbi.date
      | `Decimal of Dbi.Decimal.t
      | `Float of float
      | `Int of int
      | `Interval of Dbi.datetime
      | `Null
      | `String of string
      | `Time of Dbi.time
      | `Timestamp of Dbi.datetime
      | `Unknown of string ]
  val sql_t_to_string : Dbi.sql_t -> string
  val sdebug : Dbi.sql_t list -> string
  val intoption : int option -> Dbi.sql_t
  val stringoption : string option -> Dbi.sql_t
  type precommit_handle
  type postrollback_handle
  val string_escaped : string -> string
  val placeholders : int -> string
  exception SQL_error of string
  class virtual statement :
    Dbi.connection ->
    object
      method connection : Dbi.connection
      method virtual execute : Dbi.sql_t list -> unit
      method virtual fetch1 : unit -> Dbi.sql_t list
      method fetch1bool : unit -> bool
      method fetch1hash : unit -> (string * Dbi.sql_t) list
      method fetch1int : unit -> int
      method fetch1string : unit -> string
      method fetchall : unit -> Dbi.sql_t list list
      method finish : unit -> unit
      method fold_left : ('-> Dbi.sql_t list -> 'a) -> '-> 'a
      method fold_right : (Dbi.sql_t list -> '-> 'b) -> '-> 'b
      method iter : (Dbi.sql_t list -> unit) -> unit
      method map : (Dbi.sql_t list -> 'c) -> 'c list
      method virtual names : string list
      method virtual serial : string -> int
    end
  and virtual connection :
    ?host:string ->
    ?port:string ->
    ?user:string ->
    ?password:string ->
    string ->
    object
      method close : unit -> unit
      method closed : bool
      method commit : unit -> unit
      method database : string
      method virtual database_type : string
      method debug : bool
      method ex : string -> Dbi.sql_t list -> Dbi.statement
      method host : string option
      method id : int
      method password : string option
      method ping : unit -> bool
      method port : string option
      method virtual prepare : string -> Dbi.statement
      method prepare_cached : string -> Dbi.statement
      method register_postrollback :
        (unit -> unit) -> Dbi.postrollback_handle
      method register_precommit : (unit -> unit) -> Dbi.precommit_handle
      method rollback : unit -> unit
      method set_debug : bool -> unit
      method unregister_postrollback : Dbi.postrollback_handle -> unit
      method unregister_precommit : Dbi.precommit_handle -> unit
      method user : string option
    end
  val split_query : string -> string list
  val make_query :
    string ->
    (Dbi.sql_t -> string) -> string list -> Dbi.sql_t list -> string
end