Le Friday 22 Oct 2010 à 17:18:00 (+0200), Guillaume Yziquel a écrit :
Le Friday 22 Oct 2010 à 08:31:01 (+0200), Fabian Groffen a écrit :
On 22-10-2010 02:26:32 +0200, Guillaume Yziquel wrote:
Le Friday 22 Oct 2010 à 01:57:01 (+0200), Guillaume Yziquel a écrit :
values ('1920-12-01', 104.20, 104.20, 104.20, 104.20, 1049, 0); Asking: insert into indu (Date, Open, High, Low, Close, Volume, OI) values ('1920-13-01', 104.50, 104.50, 104.50, 104.50, 908, 0);
Stupid me: There's no such thing as a 13th month... Sorry for the bother.
I would have expected the server just to tell you this in the first case. Did the error not come up somehow, or does the OCaml binding currently not support the string exceptions from the server?
Short answer: The OCaml binding supports string exceptions from the server. Long answer: Concerning queries, I was reading the error message in the connection handle rather than in the query handle. So I was not seeing it. yziquel@seldon:~$ ocaml Objective Caml version 3.12.0 # #use "topfind";; - : unit = () Findlib has been successfully loaded. Additional directives: #require "package";; to load a package #list;; to list the available packages #camlp4o;; to load camlp4 (standard syntax) #camlp4r;; to load camlp4 (revised syntax) #predicates "p,q,...";; to set these predicates Topfind.reset();; to force that packages will be reloaded #thread;; to enable threads - : unit = () # #require "monetdb5";; /usr/lib/ocaml/monetdb5: added to search path /usr/lib/ocaml/monetdb5/monetDB5.cma: loaded # open MonetDB5;; # module DB = struct include DB.SQL let name = "my_db" end;; module DB : sig val embedded : bool val farm : string val backend : MonetDB5.language val name : string end # include Embedded (DB);; val mapi : MonetDB5.Mapi.mapi = <abstr> val query : string -> MonetDB5.Mapi.Handle.t = <fun> val ask : int list -> string -> string option list list = <fun> # let dbh = mapi;; val dbh : MonetDB5.Mapi.mapi = <abstr> # open Mapi;; # type pointer;; type pointer # type handle = private pointer;; type handle = private pointer # external raw_query : mapi -> string -> handle = "ocamlmonetdb5_mapi_query";; external raw_query : MonetDB5.Mapi.mapi -> string -> handle = "ocamlmonetdb5_mapi_query" # let h = raw_query dbh "insert into indu (Date, Open, High, Low, Close, Volume, OI) values ('1920-13-01', 104.50, 104.50, 104.50, 104.50, 908, 0)";; val h : handle = <abstr> # external raw_result_error : handle -> 'a = "ocamlmonetdb5_mapi_result_error";; external raw_result_error : handle -> 'a = "ocamlmonetdb5_mapi_result_error" # let e = raw_result_error h;; val e : 'a = <poly> # external string_of_pointer : pointer -> string = "String_valptr";; external string_of_pointer : pointer -> string = "String_valptr" # string_of_pointer e;; - : string = "SQLException:date:conversion of string '1920-13-01' failed\n" Will correct that ASAP. Best regards, -- Guillaume Yziquel http://yziquel.homelinux.org