Database interface

Bayley, Alistair Alistair_Bayley@ldn.invesco.com
Wed, 13 Aug 2003 09:58:15 +0100


> -----Original Message-----
> From: Thomas L. Bevan [mailto:thomas_bevan@toll.com.au]
> 
> This type of interface is fine as far as it goes, but there is only 
> ever a loose coupling between the database and application.
> 
> The HaskellDB work implemented a relational calculus that ensured
> that all queries were checked at compile time for validity against
> a particular database.

HaskellDB doesn't actually type check against the database; it checks
against types defined in a module, which is generated from the database. If
you change the database, then you need to regenerate the module.

I prefer the approach of passing an extraction function/IO action to the
interface. This is the approach taken by HaSql, HaskellDB (I think, although
it's so indirect I find it hard to follow), and Tim Docker's Sybase library,
and it's the design I intend to use for my Oracle library (when I get around
to it).

I still want to use HaskellDB (or at least the relational calculus part of
it), so I was thinking of splitting it into two pieces: a library that
submits SQL queries and returns the results (database interface), and a
library that constructs queries with the relational calculus and generates
SQL from them. Obviously the database interface must be written for each
DBMS product, while the relational calculus library ought to be independent
of DBMS (although it might be wise to have SQL compatibility flags for the
SQL it generates. For example: Oracle 8 (what I'm using now) only supports
SQL-92).


*****************************************************************
The information in this email and in any attachments is 
confidential and intended solely for the attention and use 
of the named addressee(s). This information may be 
subject to legal professional or other privilege or may 
otherwise be protected by work product immunity or other 
legal rules.  It must not be disclosed to any person without 
our authority.

If you are not the intended recipient, or a person 
responsible for delivering it to the intended recipient, you 
are not authorised to and must not disclose, copy, 
distribute, or retain this message or any part of it.
*****************************************************************