Database interface
Tom Pledger
Tom.Pledger@peace.com
Wed, 13 Aug 2003 16:12:15 +1200
Thomas L. Bevan writes:
:
| 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.
That validation is a Good Thing - as long as you're confident that
your database's schema won't change between compile time and run time.
Schema changes can even happen after you've connected to the database
at run time but before you send your query, so it makes sense to have
an InvalidSchema exception for cursor opening. (Database servers
should prevent schema changes which undermine already open cursors.)
To get true end-to-end validation, the client program must somehow be
registered with the database server as Something Which Cares About
Schema. Also, its queries must be expressed simply enough that they
can be analysed statically.
These difficulties are related to the use of SQL /source/ code to
express queries at /run/ time - a deeply entrenched practice!
- Tom