Monday, December 4, 2006

Finding my way around clsql

I recently decided for my project that I need to learn to use a relational database through lisp. I haven't used relational databases much. And certainly not through lisp. So I picked up PostgreSQL for windows, installed it on my laptop, and used asdf-install to fetch clsql. With only a blog post as a guide, I started down this adventure.

clsql provides are two different protocols for PostgreSQL: a socket protocol, and an FFI based protocol through the C library. I first tried the FFI based protocol. I could not get clsql_uffi.dll to load, try as I might, on ACL 8. It once magically seemed to work, but then I was thwarted in my attempts to link to pq.dll.

There is nothing in the documentation that describes the difference between the socket and FFI protocols, other than saying that one requires the dll, and the socket one does not. So I'm using the socket protocol, albeit with reservations. My previous experience with socket protocols is that they work fine in general, but tend to leave out goodies like caching. I don't know if there is a hidden gotcha with PostgreSQL, but then I'm not working on anything remotely close to a production system.

All I can say for now is, so far so good. All I want to have is a persistent data store. I might even have been able to roll my own. But I felt I needed to get my hands dirty with a database.