Archive for October, 2005

10.17.05

Common Lisp and SQL

Posted in Uncategorized at 7:00 pm by UnwashedMeme

I like Lisp, to the point of being accused of “having drunk the koolaid.” I read a good number of lisp weblogs (I’m lazy about linking right now). I lurk on #lisp all day long, although a good deal goes by unread I like following the links.

At work I’ve been trying to get a lisp and UCW setup going. However, one of the key components to making htis happen is to be able to reliably talk to a SQL database. Right now we are a predominantly Microsoft shop so charting a path from our current environment to a lisp one is somewhat tricky.

My experience has been less than good. I have tried a number of different setups and found very few combinations that work. I haven’t gotten into what I would consider weird database stuff. Just basic tables, selects and inserts. My unicode test string is: “Iñtërnâtiônàlizætiøn”

The software:

Attempted setup Does it work? Error Unicode string
SBCL -> Postgresql-socket -> postgres No - Doesn’t connect Illegal :ASCII character starting at byte position 0.
[Condition of type SB-IMPL::MALFORMED-ASCII]
the specific byte positions varies, normally in the first 4 but i’ve seen it accross the first 7 or 8.
SBCL -> UFFI -> PostgreSQL library -> postgres YES! Iñtërnâtiônàlizætiøn
SBCL -> UFFI -> UnixODBC -> FreeTDS -> MS SQL Server ‘Bit’ datatype doesn’t work. The value
#<SB-ALIEN-INTERNALS:ALIEN-VALUE :SAP #X082A6A50 :TYPE (* (SB-ALIEN:SIGNED 8))>
is not of type (SB-ALIEN:ALIEN (* (SB-ALIEN:UNSIGNED 8))).
[Condition of type TYPE-ERROR]

I didn’t know true could be negative

“I?t?rn?ti?n?liz?ti?n”
ACL -> :aodbc -> ODBC32 -> MS SQL Server YES! Iñtërnâtiônàlizætiøn
ACL -> Postgresql[-socket] For some values of true Iñtërnâtiônà lizætiøn

Some of the problems might be easy to solve for someone who knows more about the FFIs than I do. But programming in C is not why I am trying to get CL running. There are combinations that work, but this is hardly reassuring.