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 QAA27368; Fri, 13 Jun 2003 16:21:17 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id QAA27760 for ; Fri, 13 Jun 2003 16:21:15 +0200 (MET DST) Received: from abel.swapping.umh.ac.be (nat.umh.ac.be [193.190.193.1]) by concorde.inria.fr (8.11.1/8.11.1) with ESMTP id h5DELFH25673 for ; Fri, 13 Jun 2003 16:21:15 +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 19QpVb-0002P8-00; Fri, 13 Jun 2003 16:26:27 +0200 Date: Fri, 13 Jun 2003 16:26:26 +0200 (CEST) Message-Id: <20030613.162626.79289918.debian00@tiscali.be> To: Damien.Pous@ens-lyon.fr Cc: caml-list@inria.fr Subject: Re: [Caml-list] Dbi: proposal #1 From: Christophe TROESTLER In-Reply-To: <1055491953.7515.13.camel@lamppc21.epfl.ch> References: <20030611161339.GA6982@redhat.com> <20030612.210736.101270708.debian00@tiscali.be> <1055491953.7515.13.camel@lamppc21.epfl.ch> Organization: None X-Spook: Cocaine CDC Firewalls Elvis Comirex virus defense information warfare Taiwan beanpole Blowpipe 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-Spam: no; 0.00; troestler:01 tiscali:99 caml-list:01 dbi:99 damien:01 ens-lyon:01 printf:01 kprintf:01 dbh:99 toto:01 arf:01 3.3:99 closures:01 chris:01 christophe:01 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk On 13 Jun 2003, Damien Pous wrote: > > with the CVS Printf.kprintf, you can do something like > [...] > let dbh = new dbh > let q1 = dbh#prepare "toto %d" > let q2 = dbh#prepare "titi %s %f" > let a1 = q1#execute 1000 > let a2 = q2#execute "arf" 3.3 Well, this has several drawbacks. First, the strings are not properly escaped w.r.t. the database rules. For example, you must write INSERT INTO table(a,b) VALUES ('a\'b', NULL) but with kprintf "a'b" will not be properly escaped. (This is a common mistake people do with the PHP approach.) There is also no nice way to handle NULL values, to support transparently all SQL92 types (what about DATE, TIMESTAMP, DECIMAL,...) nor to add new types (want to decode Mysql sets; want to store closures?). No optimization of the query is possible. Finally, this syntax is not compatible with standard prepared queries (prepared queries are even mandatory for Oracle I've been told) -- if the database supports prepared queries, the DB mechanism should be used. 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