[sqlite] do not wrap results into `Some _` needlessly

Summary: All the rows were wrapped in `Some` but that is not needed anywhere.

Reviewed By: mbouaziz

Differential Revision: D8783310

fbshipit-source-id: b020af3
master
Jules Villard 7 years ago committed by Facebook Github Bot
parent 0f79fd8d94
commit aebeca3388

@ -82,7 +82,7 @@ let get_all () =
let db = ResultsDatabase.get_database () in let db = ResultsDatabase.get_database () in
Sqlite3.prepare db "SELECT source_file FROM source_files" Sqlite3.prepare db "SELECT source_file FROM source_files"
|> SqliteUtils.sqlite_result_rev_list_step db ~log:"getting all source files" |> SqliteUtils.sqlite_result_rev_list_step db ~log:"getting all source files"
|> List.filter_map ~f:(Option.map ~f:SourceFile.SQLite.deserialize) |> List.map ~f:SourceFile.SQLite.deserialize
let load_proc_names_statement = let load_proc_names_statement =

@ -40,7 +40,7 @@ let sqlite_result_rev_list_step ?finalize:(do_finalize = true) db ~log stmt =
match Sqlite3.step stmt with match Sqlite3.step stmt with
| Sqlite3.Rc.ROW -> | Sqlite3.Rc.ROW ->
(* the operation returned a result, get it *) (* the operation returned a result, get it *)
let value = Some (Sqlite3.column stmt 0) in let value = Sqlite3.column stmt 0 in
aux (value :: rev_results) aux (value :: rev_results)
| DONE -> | DONE ->
rev_results rev_results
@ -56,7 +56,7 @@ let sqlite_result_step ?finalize db ~log stmt =
| [] -> | [] ->
None None
| [x] -> | [x] ->
x Some x
| l -> | l ->
L.die InternalError "%s: zero or one result expected, got %d instead" log (List.length l) L.die InternalError "%s: zero or one result expected, got %d instead" log (List.length l)

@ -20,7 +20,7 @@ val finalize : Sqlite3.db -> log:string -> Sqlite3.stmt -> unit
(** Finalize the given [stmt]. Raises [Error] on failure. *) (** Finalize the given [stmt]. Raises [Error] on failure. *)
val sqlite_result_rev_list_step : val sqlite_result_rev_list_step :
?finalize:bool -> Sqlite3.db -> log:string -> Sqlite3.stmt -> Sqlite3.Data.t option list ?finalize:bool -> Sqlite3.db -> log:string -> Sqlite3.stmt -> Sqlite3.Data.t list
(** Return a reversed list of results obtained by repeatedly stepping through [stmt] and saving only column 0 of each returned row (all that's been needed so far). *) (** Return a reversed list of results obtained by repeatedly stepping through [stmt] and saving only column 0 of each returned row (all that's been needed so far). *)
val sqlite_result_step : val sqlite_result_step :

Loading…
Cancel
Save