ocaml-mysql icon indicating copy to clipboard operation
ocaml-mysql copied to clipboard

Prepared statements cannot fetch FLOAT values

Open everiq opened this issue 10 years ago • 1 comments

module M = Mysql
module P = Mysql.Prepared

let () =
    let db = M.quick_connect ~database:"test" () in
    let _ = M.exec db "create table if not exists x(f float)" in
    let _ = M.exec db "insert into x values(1.2)" in
    let stmt = P.create db "select * from x" in
    begin match P.fetch (P.execute stmt [||]) with
    | Some [| Some f |] -> Printf.printf "%S\n" f
    | _ -> assert false
    end;
    P.close stmt

This snippet prints empty string. Expected to print inserted value 1.2.

Looks like fetching of float values is broken for prepared statements.

everiq avatar Jul 24 '15 10:07 everiq

The same problem occurs with type double, btw...

darioteixeira avatar Sep 18 '16 11:09 darioteixeira