Closed NightBlues closed 5 years ago
Also, I wrote some boilerplate code to integrate sequoia with pgocaml. Maybe such code should be placed somewhere in sequoia-postgresql or separate library? For example:
let sequoia_to_pgocaml =
let open Postgresql.Param in
function
| String v -> Some (PGOCaml.string_of_string v)
| Int v -> Some (PGOCaml.string_of_int v)
| Bool v -> Some (PGOCaml.string_of_bool v)
| Float v -> Some (PGOCaml.string_of_float v)
| _ -> failwith "Not implemented conversion"
let run_sequoia sq dbh =
let query, params_seq = Postgresql.Select.seal sq in
let params = List.map sequoia_to_pgocaml params_seq in
let prepare = PGOCaml.prepare dbh ~query () in
let rows = PGOCaml.bind prepare (fun () ->
PGOCaml.execute dbh ~params ()) in
rows
Hi there! I've tried to use sequoia-postgresql with pgocaml and found that placeholder seems to be wrong. I'm not fluent with sql, but I see that postgres prepare statements do not accept params as ?: