diff --git a/infer/src/base/DBWriter.ml b/infer/src/base/DBWriter.ml index adff68f4c..1753d7b2d 100644 --- a/infer/src/base/DBWriter.ml +++ b/infer/src/base/DBWriter.ml @@ -152,6 +152,14 @@ module Implementation = struct let canonicalize () = let db = ResultsDatabase.get_database () in SqliteUtils.exec db ~log:"running VACUUM" ~stmt:"VACUUM" + + + let reset_capture_tables () = + let db = ResultsDatabase.get_database () in + SqliteUtils.exec db ~log:"drop procedures table" ~stmt:"DROP TABLE procedures" ; + ResultsDatabase.create_procedures_table db ; + SqliteUtils.exec db ~log:"drop source_files table" ~stmt:"DROP TABLE source_files" ; + ResultsDatabase.create_source_files_table db end module Command = struct @@ -172,6 +180,7 @@ module Command = struct | MarkAllSourceFilesStale | MergeDBs of {infer_out_src: string} | Vacuum + | ResetCaptureTables | Handshake | Terminate @@ -186,6 +195,8 @@ module Command = struct "MergeDBs" | Vacuum -> "Vacuum" + | ResetCaptureTables -> + "ResetCaptureTables" | Handshake -> "Handshake" | Terminate -> @@ -206,6 +217,8 @@ module Command = struct Implementation.merge_dbs ~infer_out_src | Vacuum -> Implementation.canonicalize () + | ResetCaptureTables -> + Implementation.reset_capture_tables () | Handshake -> () | Terminate -> @@ -315,3 +328,5 @@ let mark_all_source_files_stale () = perform Command.MarkAllSourceFilesStale let merge_dbs ~infer_out_src = Command.MergeDBs {infer_out_src} |> perform let canonicalize () = perform Command.Vacuum + +let reset_capture_tables () = perform Command.ResetCaptureTables diff --git a/infer/src/base/DBWriter.mli b/infer/src/base/DBWriter.mli index 2d3aea8da..5e62bf530 100644 --- a/infer/src/base/DBWriter.mli +++ b/infer/src/base/DBWriter.mli @@ -35,6 +35,8 @@ val merge_dbs : infer_out_src:string -> unit val canonicalize : unit -> unit (** put the database on disk in deterministic form *) +val reset_capture_tables : unit -> unit [@@warning "-32"] + val start : unit -> unit val stop : unit -> unit diff --git a/infer/src/base/ResultsDatabase.mli b/infer/src/base/ResultsDatabase.mli index b2b5439c1..a0d2a9b27 100644 --- a/infer/src/base/ResultsDatabase.mli +++ b/infer/src/base/ResultsDatabase.mli @@ -17,7 +17,14 @@ val schema_hum : string (** some human-readable string describing the tables *) val get_database : unit -> Sqlite3.db -(** The results database. You should always use this function to access the database, as the connection to it may change during the execution (see [new_database_connection]). *) +(** The results database. You should always use this function to access the database, as the + connection to it may change during the execution (see [new_database_connection]). *) + +val create_procedures_table : Sqlite3.db -> unit +(** create a procedures table in the database*) + +val create_source_files_table : Sqlite3.db -> unit +(** create a source files table in the database*) val new_database_connection : unit -> unit (** Closes the previous connection to the database (if any), and opens a new one. Needed after calls to fork(2). *)