ygrek / ocaml-mysql

OCaml bindings to libmysqlclient
https://ygrek.org.ua/p/ocaml-mysql
GNU Lesser General Public License v2.1
23 stars 11 forks source link

Prepared statements cannot fetch FLOAT values #3

Open everiq opened 9 years ago

everiq commented 9 years ago
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.

darioteixeira commented 8 years ago

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