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: Christophe TROESTLER <debian00@t...>
Subject: Re: [Caml-list] Printf question
On Tue, 30 Sep 2003, Pierre Weis <pierre.weis@inria.fr> 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