[MonetDB-users] OCaml binding for embedded MonetDB5.
![](https://secure.gravatar.com/avatar/f4e0fe39f2c73a9e43edc1d3c380a439.jpg?s=120&d=mm&r=g)
Hello.
I would like to create a binding for the Objective Caml language of an embedded MonetDB5. My personal focus would be on embedded_mal, but I'm perfectly willing to get started on embedded_sql.
I've been looking at some documentation, which I unfortunately find rather terse. For instance:
http://monetdb.cwi.nl/MonetDB/Documentation/A-Simple-Example.html
I'm, for example, wondering about the semantics of the embedded_sql function whose code from embeddedclient.c.in is reproduced below.
Mapi embedded_sql(opt *set, int len) { Mapi mid; pthread_t sqlthread; stream **server;
if (set) { embedded_set = set; embedded_len = len; } server = mapi_embedded_init(&mid,"sql"); pthread_create(&sqlthread, NULL, start_sql_server, (void *) server); mapi_start_talking(mid); return mid;
}
I'd therefore like to know if there is some piece of documentation (aside the code itself) where I could gain a deeper understanding of what I want to wrap up and bind.
Links appreciated.
![](https://secure.gravatar.com/avatar/f4e0fe39f2c73a9e43edc1d3c380a439.jpg?s=120&d=mm&r=g)
Guillaume Yziquel a écrit :
Hello.
I would like to create a binding for the Objective Caml language of an embedded MonetDB5. My personal focus would be on embedded_mal, but I'm perfectly willing to get started on embedded_sql.
I've been looking at some documentation, which I unfortunately find rather terse. For instance:
http://monetdb.cwi.nl/MonetDB/Documentation/A-Simple-Example.html
I'm, for example, wondering about the semantics of the embedded_sql function whose code from embeddedclient.c.in is reproduced below.
For instance, I've made a simple wrapper around the embedded_sql function, and I get the following output:
ocaml -init ocamlinit Objective Caml version 3.11.1
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
# module X = MonetDB5;; module X : sig type opt = MonetDB5.opt module Mapi : sig type t = MonetDB5.Mapi.t end val embedded_sql : ?opt:opt -> ?len:int -> unit -> Mapi.t end # let mapi = embedded_sql ();; Error: Unbound value embedded_sql # let mapi = MonetDB5.embedded_sql ();; !FATAL: GDKlockHome: could not create /var/MonetDB/tst/
I do not understand why it looks for /var/MonetDB/tst, and I would like to look for some other location. It seems to me that this can be changed in the opt structure passed as first argument. (I've been passing a NULL pointer there, as in the example available on the link above).
The C glue code is the following:
CAMLprim value ml_embedded_sql (value ml_set, value ml_len) { CAMLparam2(ml_set, ml_len); CAMLlocal1(result); result = Val_ptr(embedded_sql((opt *) Ptr_val(ml_set), Int_val(ml_len))); CAMLreturn(result); }
Help would be appreciated.
All the best,
participants (1)
-
Guillaume Yziquel