sig
  type numeric_option = NO_None | NO_Unsigned | NO_UnsignedZeroFill
  type ty =
      TinyInt of int option * Dbf_sql.SQL_db.numeric_option
    | MediumInt of int option * Dbf_sql.SQL_db.numeric_option
    | Int of int option * Dbf_sql.SQL_db.numeric_option
    | BigInt of int option * Dbf_sql.SQL_db.numeric_option
    | Double of (int * int) option * Dbf_sql.SQL_db.numeric_option
    | Float of (int * int) option * Dbf_sql.SQL_db.numeric_option
    | Decimal of (int * int) option * Dbf_sql.SQL_db.numeric_option
    | Char of int
    | VarChar of int
    | TinyBlob
    | Blob
    | MediumBlob
    | LongBlob
    | TinyText
    | Text
    | MediumText
    | LongText
  type table = {
    mutable ta_name : string;
    mutable ta_comment : string;
    mutable ta_pkey : Dbf_sql.SQL_db.column list;
    mutable ta_db : Dbf_sql.SQL_db.db;
    mutable ta_columns : Dbf_sql.SQL_db.column list;
    mutable ta_logged : bool;
  }
  and vtable = {
    mutable vt_name : string;
    mutable vt_db : Dbf_sql.SQL_db.db;
    mutable vt_ftable : Dbf_sql.SQL_db.table;
    mutable vt_join :
      (Dbf_sql.SQL_db.table *
       (Dbf_sql.SQL_db.column * Dbf_sql.SQL_db.column) list)
      list;
  }
  and column = {
    mutable col_name : string;
    mutable col_comment : string;
    mutable col_table : Dbf_sql.SQL_db.table;
    mutable col_type : Dbf_sql.SQL_db.ty;
    mutable col_nullable : bool;
    mutable col_spec_options : string list Dbf_misc.StringMap.t;
    mutable col_spec_ty : string Dbf_misc.StringMap.t;
    mutable col_ocaml_ty : string;
    mutable col_sql2ml : string;
    mutable col_ml2sql : string;
  }
  and index = {
    mutable idx_name : string;
    mutable idx_columns : Dbf_sql.SQL_db.column list;
    mutable idx_unique : bool;
    mutable idx_db : Dbf_sql.SQL_db.db;
  }
  and query = {
    mutable qry_name : string;
    mutable qry_query : string;
    mutable qry_comment : string;
    mutable qry_db : Dbf_sql.SQL_db.db;
  }
  and db = {
    mutable db_tables : Dbf_sql.SQL_db.table list;
    mutable db_vtables : Dbf_sql.SQL_db.vtable list;
    mutable db_indexes : Dbf_sql.SQL_db.index list;
    mutable db_queries : Dbf_sql.SQL_db.query list;
  }
  exception Duplicated_name of string
  exception Invalid_name of string
  exception Invalid_args of string
  val validate_name : string -> bool
  val validate_name_exn : string -> unit
  val create_empty : unit -> Dbf_sql.SQL_db.db
  val create_table_name :
    Dbf_sql.SQL_db.db -> ?prefix:string -> ?from:int -> unit -> string
  val table_by_name : Dbf_sql.SQL_db.db -> string -> Dbf_sql.SQL_db.table
  val table_by_name_opt :
    Dbf_sql.SQL_db.db -> string -> Dbf_sql.SQL_db.table option
  val insert_table :
    Dbf_sql.SQL_db.db ->
    name:string -> comment:string -> logged:bool -> Dbf_sql.SQL_db.table
  val unlink_table :
    Dbf_sql.SQL_db.table ->
    Dbf_sql.SQL_db.vtable list * Dbf_sql.SQL_db.index list
  val rename_table : Dbf_sql.SQL_db.table -> name:string -> unit
  val set_primary_key :
    Dbf_sql.SQL_db.table -> Dbf_sql.SQL_db.column list -> unit
  val unset_primary_key : Dbf_sql.SQL_db.table -> unit
  val column_fullname : Dbf_sql.SQL_db.column -> string
  val create_column_name :
    Dbf_sql.SQL_db.table -> ?prefix:string -> ?from:int -> unit -> string
  val column_by_name :
    Dbf_sql.SQL_db.table -> name:string -> Dbf_sql.SQL_db.column
  val column_by_name_opt :
    Dbf_sql.SQL_db.table -> name:string -> Dbf_sql.SQL_db.column option
  val insert_column :
    Dbf_sql.SQL_db.table ->
    name:string ->
    comment:string ->
    ty:Dbf_sql.SQL_db.ty -> ?nullable:bool -> unit -> Dbf_sql.SQL_db.column
  val rename_column : Dbf_sql.SQL_db.column -> name:string -> unit
  val unlink_column :
    Dbf_sql.SQL_db.column ->
    Dbf_sql.SQL_db.vtable list * Dbf_sql.SQL_db.index list * bool
  val string_of_spec_options : string list Dbf_misc.StringMap.t -> string
  val create_vtable_name :
    Dbf_sql.SQL_db.db -> ?prefix:string -> ?from:int -> unit -> string
  val vtable_by_name : Dbf_sql.SQL_db.db -> string -> Dbf_sql.SQL_db.vtable
  val vtable_by_name_opt :
    Dbf_sql.SQL_db.db -> string -> Dbf_sql.SQL_db.vtable option
  val create_vtable :
    name:string -> table:Dbf_sql.SQL_db.table -> Dbf_sql.SQL_db.vtable
  val link_vtable_to_db : Dbf_sql.SQL_db.vtable -> unit
  val do_join :
    Dbf_sql.SQL_db.vtable ->
    Dbf_sql.SQL_db.table ->
    (Dbf_sql.SQL_db.column * Dbf_sql.SQL_db.column) list -> unit
  val table_in_join : Dbf_sql.SQL_db.vtable -> Dbf_sql.SQL_db.table -> bool
  val rename_vtable : Dbf_sql.SQL_db.vtable -> name:string -> unit
  val unlink_vtable : Dbf_sql.SQL_db.vtable -> unit
  val string_of_vtable : Dbf_sql.SQL_db.vtable -> string
  val vtables_using_table :
    Dbf_sql.SQL_db.table -> Dbf_sql.SQL_db.vtable list
  val vtables_using_column :
    Dbf_sql.SQL_db.column -> Dbf_sql.SQL_db.vtable list
  val create_index_name :
    Dbf_sql.SQL_db.db -> ?prefix:string -> ?from:int -> unit -> string
  val index_by_name : Dbf_sql.SQL_db.db -> string -> Dbf_sql.SQL_db.index
  val index_by_name_opt :
    Dbf_sql.SQL_db.db -> string -> Dbf_sql.SQL_db.index option
  val insert_index :
    name:string ->
    columns:Dbf_sql.SQL_db.column list -> unique:bool -> Dbf_sql.SQL_db.index
  val rename_index : Dbf_sql.SQL_db.index -> name:string -> unit
  val unlink_index : Dbf_sql.SQL_db.index -> unit
  val column_in_index : Dbf_sql.SQL_db.index -> Dbf_sql.SQL_db.column -> bool
  val string_of_index : Dbf_sql.SQL_db.index -> string
  val table_of_index : Dbf_sql.SQL_db.index -> Dbf_sql.SQL_db.table
  val update_index :
    Dbf_sql.SQL_db.index ->
    name:string -> columns:Dbf_sql.SQL_db.column list -> unique:bool -> unit
  val indexes_using_table : Dbf_sql.SQL_db.table -> Dbf_sql.SQL_db.index list
  val indexes_using_column :
    Dbf_sql.SQL_db.column -> Dbf_sql.SQL_db.index list
  type query_state =
      Query_ok of Dbf_sql.SQL_db.column option list *
        (string * Dbf_sql.SQL_db.column option) list
    | Query_parse_error of int * int * string
    | Query_invalid_against_schema of string
    | Query_incorrect of string
  val create_query_name :
    Dbf_sql.SQL_db.db -> ?prefix:string -> ?from:int -> unit -> string
  val query_by_name : Dbf_sql.SQL_db.db -> string -> Dbf_sql.SQL_db.query
  val query_by_name_opt :
    Dbf_sql.SQL_db.db -> string -> Dbf_sql.SQL_db.query option
  val insert_query :
    Dbf_sql.SQL_db.db ->
    name:string -> query:string -> comment:string -> Dbf_sql.SQL_db.query
  val rename_query : Dbf_sql.SQL_db.query -> name:string -> unit
  val unlink_query : Dbf_sql.SQL_db.query -> unit
  val update_query :
    Dbf_sql.SQL_db.query ->
    name:string -> query:string -> comment:string -> unit
  val query_state : Dbf_sql.SQL_db.query -> Dbf_sql.SQL_db.query_state
  val string_of_query_state : Dbf_sql.SQL_db.query_state -> string
end