[Haskell-cafe] HDBC's future and request for help
jgoerzen at complete.org
Wed Feb 23 17:21:46 CET 2011
On 02/23/2011 10:03 AM, Leon Smith wrote:
> My biggest (mostly) fixable complaint with HDBC is that it hasn't
> turned out to be a very complete or robust solution for accessing
> databases that like to use PostgreSQL-specific features. My biggest
This is probably true, both that it isn't designed for database-specific
features and that this is fixable.
> complaint that (probably) isn't easily fixed is it's reliance on
> Convertible, and the use of lots of unsafe pattern matching and
> exception-happy functions.
Use of Convertible (or toSql/fromSql which is based on it) isn't really
required. You could write a complete HDBC program having never touched
it, assembling and disassembling your SqlValues manually. This was a
design goal of the API. Convertible makes it easy and convenient for
the 95% common cases, but you can avoid it if you wish, or use some
other kind of conversion. All the HDBC functions work with SqlValues
(though there are some convenience wrappers that use Strings instead) so
you can build them up however you like. SqlValue is documented at
If your concern really is with how SqlValue is defined, alternative
proposals are always entertained ;-)
When you're dealing with databases over a network, exceptions can happen
just about anywhere. HDBC does have its own exception type (SqlError)
so that they can be handled en masse, or picked through more closely if
desired. If you have an idea how else that should be handled, I'm all ears.
By "unsafe pattern matching" do you mean GHC -Wall is flagging pattern
matches that don't match some possible set of input data, or something
else? If the former, that should be trivially fixable too.
> At least for the time being, I've found it easiest and most expedient
> to fix up HDBC. I'm not particularly interested in taking over the
> maintenance of HDBC, and I am comfortable with model #1 at the time
> being. However if somebody else is interested in another option,
> I'm probably ok with that too.
Thanks for your feedback, Leon. I've appreciated your patches.
More information about the Haskell-Cafe