« Phatbot | Main | SQLite Threading FreeBSD CMUCL Oh My! »

29 October 2004

lsqlite3 - Common Lisp SQLite3 interface

CL-USER> (lsqlite3:connect "/tmp/xx.db")
#<LSQLITE3::SQLITE3-CONNECTION {483CB20D}>
CL-USER> (lsqlite3:exec "select * from sqlite_master")
(("table" "a" "a" "2" "CREATE TABLE a (ak int, av int)"))
CL-USER> (lsqlite3:exec "select * from a")
(("1" "1"))
CL-USER> (lsqlite3:disconnect)
T
CL-USER> 

This is my old UncommonSQL-SQLite2 interface adapted to SQLite3.

SQLite version 2 stores all data as ASCII text. Version 3 introduces manifest typing and comes with a large number of API functions to grok data into the right type.

Notice the LSQLITE3 code above returns the data as ("1" "1") even though the database schema says both values should be integers. ;-) I may or may not support SQLite 3's manifest typing functions in LSQLITE3 because my intention is to play with prevalence using SQLite as the underlying transaction log storage: The stuff I'm going to store will be serialised Common Lisp objects; I think they can all be blobs.

BTW, CL-SQL comes with SQLite2 support. It probably won't take much effort to get to SQLite3 from there. Data is still all text, though, I believe.


Posted by ngps at 00:03 | Comments (0) | Trackbacks (0)
Comments
There is no comment.
Trackbacks
Please send trackback to:http://sandbox.rulemaker.net/ngps/148/tbping
There is no trackback.