Version française
Home     About     Download     Resources     Contact us    
Browse thread
Idea for another type safe PostgreSQL interface
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Richard Jones <rich@a...>
Subject: Re: [Caml-list] Idea for another type safe PostgreSQL interface
On Tue, Jul 19, 2005 at 08:26:30AM +0200, Alex Baretta wrote:
> I really think XDBS is the the way to go. You define the schema in a
> high level language (OO-Entity-Relationship modeling), supporting lower
> level refinements (logical, physical and virtual schema refinements) and
> compiling to Ocaml and SQL-DDL. This way, the type safety can be
> established at compile time without need for a database connection.

I think I completely understand this approach, having worked on and
with a Java technology called PDL, part of Red Hat's now defunct CMS
offering.  So I'm interested to know how you solve some of the issues
we had with PDL.

(1) Changes to the database schema.  Does your product allow you to
generate the appropriate ALTER TABLE ... statements when the schema
changes?  How about upgrading an existing live database between
versions of the schema?

(2) How is the OR mapping handled?  PDL had a complex compiler which
(supposedly) generated optimal SQL statements from object methods.  In
practice the developers seemed to spend a lot of time writing
hand-optimised queries.  I don't really understand what the fuss is
about just writing SQL queries directly into code - it's the fastest
way I've found to achieve results (if only it were type safe), seems
reasonably maintainable, and gets rid of layers of obscure
abstraction.

In the end I stopped using PDL because the mooted "benefits" - that
everything was written in a bunch of obscure files in their case -
really didn't have any bearing on real development.  I can quite
happily tap CREATE TABLE and ALTER TABLE statements directly into a
development database, export the schema to CVS to keep track of
changes, and use a tool to diff the dev and live schemas for roll-outs
and upgrades.

> Also, the type safety does not depend on a specific implementation of
> SQL, which is usually desireable.

I take your point, but really PostgreSQL already does everything I'm
ever likely to want to do with a database, it's Free, stable and fast,
and actively under development.

Rich.

PS. Something about PDL here:
http://www.redhat.com/docs/manuals/waf/rhea-dg-waf-en-6.0/s1-do-beginning.html

-- 
Richard Jones, CTO Merjis Ltd.
Merjis - web marketing and technology - http://merjis.com
Team Notepad - intranets and extranets for business - http://team-notepad.com