let string_of_query_state = function
| Query_invalid_against_schema s -> s
| Query_incorrect s -> s
| Query_parse_error (l,c,s) ->
Printf.sprintf "%s line %d character %d" s l c
| Query_ok (t,params) ->
let type_of_col_opt = function
None -> "string option"
| Some col ->
Printf.sprintf "(%s%s)"
col.col_ocaml_ty
(if col.col_nullable then " option" else "")
in
let params = List.map
(fun (name,copt) ->
Printf.sprintf "%s: %s -> " name
(type_of_col_opt copt)
)
params
in
let t = Printf.sprintf "(%s) list"
(String.concat "*" (List.map type_of_col_opt t))
in
Printf.sprintf "%s %s" (String.concat "" params) t