22 let parse_one (stmt
,props
) =
24 (* print_endline stmt; *)
25 Some
((Parser.parse_stmt stmt
), Props.set props
"sql" stmt
)
29 Error.log
"==> %s" stmt
;
33 let show_one ((s
,p
),props
) =
35 print_endline
(Stmt.params_to_string p
)
37 let get_statements ch
=
38 let lexbuf = Lexing.from_channel ch
in
39 let f () = try Sql_lexer.ruleStatement
Props.empty
lexbuf with exn
-> None
in
42 | None
-> raise
Enum.No_more_elements
44 begin match parse_one s
with
51 let with_file filename
f =
52 match catch
Std.input_file filename
with
53 | None
-> Error.log
"cannot open file : %s" filename
56 let with_channel filename
f =
57 match catch open_in filename
with
58 | None
-> Error.log
"cannot open file : %s" filename
59 | Some ch
-> Std.finally
(fun () -> close_in_noerr ch
) f ch