[Haskell] Re: Haskell DB bindings (was Re: ANN: HDBC (Haskell Database Connectivity)

John Goerzen jgoerzen at complete.org
Sun Jan 15 10:58:57 EST 2006


On 2006-01-14, Keean Schupke <k.schupke at imperial.ac.uk> wrote:
> Erm, has nobody replied to this yet? I want a robust interface, that 
> uses bracket notation all the way down, so that any error is caught and 
> resources are freed appropriately without the use of finalizers (which 
> may not get run and lead to resource starvation - they are not reliable 

To be sure, your only failure situation in this case is if you're
dealing with many connections *and* creating/destroying them frequently.

Hopefully you wouldn't be.

> if dealing with many connections, unless you start forcing garbage 
> collections). I want a simple interface (as few functions as possible to 
> do the job) and robust exception handling.

HDBC will let you manually close (and free) database objects.  If you
don't manually do that, they will be automatically closed/freed at
garbage collection time.  It uses a small C wrapper to make this happen
correctly.

It doesn't have built-in support for bracketing things all the way down,
but functions to do that are already in the testsuite.  It would be
trivial to add them to HDBC proper, since there is robust exception
handling all through.

The HDBC API is at:

http://darcs.complete.org/hdbc/doc/Database-HDBC.html

I didn't honestly follow the STRef discussion, or how something so
I/O-based could work there.

-- John



More information about the Haskell mailing list