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 OAA30174; Sat, 12 Oct 2002 14:04:43 +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 OAA30326 for ; Sat, 12 Oct 2002 14:04:43 +0200 (MET DST) Received: from mel-rto3.wanadoo.fr (smtp-out-3.wanadoo.fr [193.252.19.233]) by nez-perce.inria.fr (8.11.1/8.11.1) with ESMTP id g9CC4gD18185 for ; Sat, 12 Oct 2002 14:04:42 +0200 (MET DST) Received: from mel-rta9.wanadoo.fr (193.252.19.69) by mel-rto3.wanadoo.fr (6.5.007) id 3DA24D1800303CB5; Sat, 12 Oct 2002 14:04:41 +0200 Received: from warp (81.49.32.85) by mel-rta9.wanadoo.fr (6.5.007) id 3DA24B290030C900; Sat, 12 Oct 2002 14:04:41 +0200 Message-ID: <007f01c271e7$ba06b120$55203151@warp> From: "Nicolas Cannasse" To: "Alessandro Baretta" , "Ocaml" References: <3DA6B04E.1090900@baretta.com> Subject: Re: [Caml-list] PostgreSQL and Ocaml Date: Sat, 12 Oct 2002 14:05:58 +0200 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 5.50.4522.1200 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4522.1200 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk > I have found an excellent client library to access > PostgreSQL databases from Ocaml applications. This I have > put to use with excellent results in the development of a > web application, together with Netcgi. However, most of the > logic of my program is written and stored in the database as > sql and pl/pgsql stored procedures. While SQL is overall a > very good language to express computations in relational > algebra, it is very weak (pratiquement, c'est nul) in > general algorithms, so for anything more complex than a > query one has to resort to pl/pgSQL, which is as powerful as > an ordinary imperative language with the added bonus of > having SQL constructs for relational algebra. What it lacks > is type safety. After having come in contact with OCaml, I > can hardly live with a language with no type safety. Few months ago I investigated the ability to write UDF ( User Defined Function ) for MySQL under Win32. But it seems like this feature is only available under *Nix versions of MySQL. The main points are the same. First you write a C function with specific API in order to access fields and values in a given row. Then you compile the C into a server-side DLL and register it under MySQL with a specific SQL command which add a new SQL keyword binded to your function. Is there any differences with PortgreSQL ? If only the API calls differs, should I advise you to consider having an "opened API" design ( in order to support both PostgreSQL, MySQL, and maybe other systems... ) > Now I wonder: has nobody written a PostgreSQL server-side > binding for Ocaml? I have searched Google on the subject, > but found nothing relevant. > > If nobody has, would anyone like to join me in the project > of writing an add-in for PostgreSQL supporting Ocaml stored > procedures? I have little experience in this, but it should > not be too difficult: it should be a matter of writing a C > dll which, upon initialization, starts a bytecode compiler > and interpreter, and has callbacks through with which the > server can request the compilation of a text string or the > execution of a bytecode cmo blob. Although I think I might > succeed by myself, I'd still prefer to work in company, if I > have to. :) Although I don't have dev time for it, I would agree to share ideas and point of view with you about this subject. Regards, Nicolas Cannasse ------------------- 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