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 QAA00632; Wed, 1 Oct 2003 16:39:41 +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 QAA28437 for ; Wed, 1 Oct 2003 16:39:39 +0200 (MET DST) Received: from abel.swapping.umh.ac.be (nat.umh.ac.be [193.190.193.1]) by nez-perce.inria.fr (8.11.1/8.11.1) with ESMTP id h91Edc502033; Wed, 1 Oct 2003 16:39:38 +0200 (MET DST) Received: from abel.swapping.umh.ac.be ([127.0.0.1] helo=localhost ident=trch) by abel.swapping.umh.ac.be with esmtp (Exim 3.36 #1 (Debian)) id 1A4i8y-00081c-00; Wed, 01 Oct 2003 16:39:56 +0200 Date: Wed, 01 Oct 2003 16:39:55 +0200 (CEST) Message-Id: <20031001.163955.29676500.debian00@tiscali.be> To: pierre.weis@inria.fr Cc: skaller@ozemail.com.au, rich@annexia.org, caml-list@inria.fr Subject: Re: [Caml-list] Printf question From: Christophe TROESTLER In-Reply-To: <200309302052.WAA26950@pauillac.inria.fr> References: <1064927948.8999.18.camel@pelican> <200309302052.WAA26950@pauillac.inria.fr> Organization: None X-Spook: wire transfer electronic surveillance USCODE clandestine North Korea LABLINK Cohiba propaganda freedom Elvis X-Mailer-URL: http://www.mew.org/ X-Operating-System: GNU/Linux (http://www.linux.org/) X-Blessing: Om Ah Hum Vajra Guru Pema Siddhi Hum X-Mailer: Mew version 3.3rc1 on Emacs 21.2 / Mule 5.0 (SAKAKI) 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; caml-list:01 printf:01 troestler:01 tiscali:99 pierre:01 weis:01 pierre:01 weis:01 outputs:01 camlp:01 normalized:01 firstname:99 firstname:99 statically:01 typechecked:01 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk On Tue, 30 Sep 2003, Pierre Weis wrote: > > [...] two stages approach [...] eliminate the generation of > trivially wrong programs (wrong requests). > > Mmm, this is interesting, [...] Indeed. So if I got what you say right, one should 1) Develop AST for SQL requests which would guarantee their internal coherence (and also write a tool for each DB engine that, for a given database, outputs a module (or so) to enable the checking of the query against the DB types (1)). 2) Develop Camlp4 macros that translate SQL requests into AST (a la "embedded SQL" rather than with strings -- AFAIK embedded SQL is normalized). This would also solve the "binding to variables" problem. One could conform to standard embedded SQL and/or provide forms that are more "functional", e.g. let FirstName, LastName = EXEC SQL SELECT OWNERFIRSTNAME, OWNERLASTNAME FROM ANTIQUEOWNERS WHERE BUYERID = :BuyerID in ... instead of EXEC SQL SELECT OWNERFIRSTNAME, OWNERLASTNAME INTO :FirstName, :LastName FROM ANTIQUEOWNERS WHERE BUYERID = :BuyerID in ... or let v1, v2, v3 = EXEC SQL FETCH ItemCursor in ... instead of EXEC SQL FETCH ItemCursor INTO :v1, :v2, :v3 in ... 3) Write, for each DB engine, an "evaluator" of the AST. Once this is done (we need interested people here!!), if the source compile the requests will be valid SQL queries and statically typechecked against the DB (given (1)). Is it possible to evaluate how much effort is needed to get to this point? Do people know where to find some (documented) AST for SQL expressions? What is the opinion of the existing DB interfaces writers? Cheers, ChriS ------------------- 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