From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id LAA26016; Sat, 27 Sep 2003 11:39:36 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id LAA21539 for ; Sat, 27 Sep 2003 11:39:35 +0200 (MET DST) Received: from mallaury.noc.nerim.net (smtp-106-saturday.noc.nerim.net [62.4.17.106]) by nez-perce.inria.fr (8.11.1/8.11.1) with ESMTP id h8R9dY514161 for ; Sat, 27 Sep 2003 11:39:34 +0200 (MET DST) Received: from cobalt.max.fr (zoggy.net1.nerim.net [62.212.116.8]) by mallaury.noc.nerim.net (Postfix) with SMTP id B32CE62D5C for ; Sat, 27 Sep 2003 11:39:33 +0200 (CEST) Date: Sat, 27 Sep 2003 11:39:30 +0200 From: Maxence Guesdon To: caml-list@inria.fr Subject: Re: [Caml-list] Printf question Message-Id: <20030927113930.7148b4e5.maxence.guesdon@inria.fr> In-Reply-To: <20030927091408.GB14604@redhat.com> References: <20030926180248.GA14053@redhat.com> <16244.54690.54537.392805@karryall.dnsalias.org> <20030927072325.GA14604@redhat.com> <20030927082007.GA15720@bourg.inria.fr> <20030927091408.GB14604@redhat.com> Organization: INRIA X-Mailer: Sylpheed version 0.9.5claws (GTK+ 1.2.10; i686-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Loop: caml-list@inria.fr X-Spam: no; 0.00; maxence:01 guesdon:01 maxence:01 guesdon:01 caml-list:01 printf:01 dbforge:01 cameleon:01 dbforge:01 schema:01 schema:01 ocaml-mysql:01 ocamlodbc:01 cameleon:01 ocaml:01 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk 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