@ -12,27 +12,27 @@ module L = Logging
let select_all_procedures_like_statement =
let select_all_procedures_like_statement =
ResultsDatabase . register_statement
ResultsDatabase . register_statement
" SELECT * FROM procedures WHERE proc_name LIKE :pname_like AND source_file LIKE \
" SELECT * FROM procedures WHERE proc_name _hum LIKE :proc_ name_like AND source_file LIKE \
: source_file_like "
: source_file_like "
let pp_all ? filter ~ proc_name ~ attr_kind ~ source_file ~ proc_attributes fmt () =
let pp_all ? filter ~ proc_name ~ attr_kind ~ source_file ~ proc_attributes fmt () =
let source_file_like , p name_like =
let source_file_like , p roc_ name_like =
match filter with
match filter with
| None ->
| None ->
let wildcard = Sqlite3 . Data . TEXT " % " in
let wildcard = Sqlite3 . Data . TEXT " % " in
( wildcard , wildcard )
( wildcard , wildcard )
| Some filter_string ->
| Some filter_string ->
match String . lsplit2 ~ on : ':' filter_string with
match String . lsplit2 ~ on : ':' filter_string with
| Some ( source_file_like , p name_like) ->
| Some ( source_file_like , p roc_ name_like) ->
( Sqlite3 . Data . TEXT source_file_like , Sqlite3 . Data . TEXT p name_like)
( Sqlite3 . Data . TEXT source_file_like , Sqlite3 . Data . TEXT p roc_ name_like)
| None ->
| None ->
L . die UserError
L . die UserError
" Invalid filter for procedures. Please see the documentation for --procedures-filter \
" Invalid filter for procedures. Please see the documentation for --procedures-filter \
in ` infer explore - - help ` . "
in ` infer explore - - help ` . "
in
in
ResultsDatabase . with_registered_statement select_all_procedures_like_statement ~ f : ( fun db stmt ->
ResultsDatabase . with_registered_statement select_all_procedures_like_statement ~ f : ( fun db stmt ->
Sqlite3 . bind stmt 1 (* :p name_like *) p name_like
Sqlite3 . bind stmt 1 (* :p roc_ name_like *) p roc_ name_like
| > SqliteUtils . check_sqlite_error db ~ log : " procedures filter pname bind " ;
| > SqliteUtils . check_sqlite_error db ~ log : " procedures filter pname bind " ;
Sqlite3 . bind stmt 2 (* :source_file_like *) source_file_like
Sqlite3 . bind stmt 2 (* :source_file_like *) source_file_like
| > SqliteUtils . check_sqlite_error db ~ log : " procedures filter source file bind " ;
| > SqliteUtils . check_sqlite_error db ~ log : " procedures filter source file bind " ;
@ -45,19 +45,18 @@ let pp_all ?filter ~proc_name ~attr_kind ~source_file ~proc_attributes fmt () =
match Sqlite3 . step stmt with
match Sqlite3 . step stmt with
| Sqlite3 . Rc . ROW ->
| Sqlite3 . Rc . ROW ->
let proc_name_hum =
let proc_name_hum =
(* same as proc_name for now, will change later *)
match [ @ warning " -8 " ] Sqlite3 . column stmt 1 with Sqlite3 . Data . TEXT s -> s
match [ @ warning " -8 " ] Sqlite3 . column stmt 0 with Sqlite3 . Data . TEXT s -> s
in
in
Format . fprintf fmt " @[<h2>%s:@ %a%a%a%a@]@ \n " proc_name_hum
Format . fprintf fmt " @[<h2>%s:@ %a%a%a%a@]@ \n " proc_name_hum
( pp_if source_file SourceFile . SQLite . deserialize SourceFile . pp )
( pp_if source_file SourceFile . SQLite . deserialize SourceFile . pp )
2
3
( pp_if proc_name Typ . Procname . SQLite . deserialize Typ . Procname . pp )
( pp_if proc_name Typ . Procname . SQLite . deserialize Typ . Procname . pp )
0
0
( pp_if attr_kind Attributes . deserialize_attributes_kind Attributes . pp_attributes_kind )
( pp_if attr_kind Attributes . deserialize_attributes_kind Attributes . pp_attributes_kind )
1
2
( pp_if ~ newline : true proc_attributes ProcAttributes . SQLite . deserialize
( pp_if ~ newline : true proc_attributes ProcAttributes . SQLite . deserialize
ProcAttributes . pp )
ProcAttributes . pp )
3 ;
4 ;
aux ()
aux ()
| DONE ->
| DONE ->
()
()