On Wed, Jul 21, 2010 at 7:54 AM, Gour <gour@gour-nitai.com> wrote:
Hello!

We are looking for recommendation which Haskell bindings for sqlite3
to use for destkop GUI app where we want, among other things to store
*.png and/or *.jpg images. (Yeah, I know about the hint to store
iamges in the filesystem and just store filepaths in the db, but for
portability reasons so that user can easily carry/backup database, we
want everything stored in one file.)

By looking at Hackage, it seems there are 3 candidates:

1) sqlite - bindings by Galois
(http://hackage.haskell.org/package/sqlite) - looks quite complete &
low-level interface

2) direct-sqlite - it says "It is not as complete as bindings-sqlite3 (1),
but is slightly higher-level...it supports strings encoded as UTF8,
and BLOBs represented as ByteStrings." and

3) HDBC-sqlite3 - higher level but without support for BLOBs.


Now, based on the above it looks that 2) is the best one - not
high-level as 2), but adding BLOBs support which, iirc, is missing in
HDBC.

Otoh, having highr-level abstraction ala HDBC is nice, although at the
moment we believe that we won't have need to go to PostgreSQL since it
means that setup would be greatly complicated for the end-user, so
we're staying focused on Sqlite3.


I know there are also Takusen & HSQL, but based on my past experiences
when watching those two projects, it seems they aren not supported as
well as the above itemized ones.

Any recommendation?

May I add that, according to the recent "Merge hsql and HDBC -- there
can only be one!" thread, I can only "+1" for having slight less &
more complete database packages.


Sincerely,
Gour

For the sqlite backend for persistent, I took direct-sqlite and modified it slightly. I have a long history of using the sqlite3 C API, so the API felt very familiar to me.

If I'm not mistaken, direct-sqlite does not build as-is on hackage because it's missing a reference to the C library. However, if you take my approach and just include the code in your library, you can fix that easily enough.

MichaelĀ