Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] Printf question
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Maxence Guesdon <maxence.guesdon@i...>
Subject: Re: [Caml-list] Printf question
Hi,

> To be completely safe at compile time, the OCaml code and the database
> tables would need to be generated from some common source. That
> approach is probably too heavyweight.

In DBForge, included in Cameleon, you define your tables, with some
information about the ocaml type for each column and the functions to
tranlate to and from these ocaml type. Then dbforge generates a module
with a module per table, with the following functions in each module:
create, insert, update, delete, select, drop. 
The functions have types using the types of the columns you indicated in
the schema. Thus you get for free the main functions to access each table
separately.

A future extension is the possibility to define sql queries. Dbforge would
then check the queries against the schema, and embed them in functions
(still with the types you specified for columns). And all this at compile
time.

DBForge can generate code for OCaml-Mysql, OCaml-Postgresql and OCamlODBC.

Cameleon: http://savannah.nongnu.org/projects/cameleon

Regards,

- Maxence Guesdon

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners