Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

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

> 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

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

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



- Maxence Guesdon

To unsubscribe, mail Archives:
Bug reports: FAQ:
Beginner's list: