let query_state = fun query ->
    try
      let q = Sqml.query_of_string query.qry_query in
      let (t,l) = query_parameters query.qry_db q in
      Query_ok (t,l)
    with
      Sqml.Syntax_error (l,c,s) -> Query_parse_error (l,c,s)
    | Bad_query s -> s