This post originated from an RSS feed registered with Python Buzz
by Ng Pheng Siong.
Original Post: lsqlite3 - Common Lisp SQLite3 interface
Feed Title: (render-blog Ng Pheng Siong)
Feed URL: http://sandbox.rulemaker.net/ngps/rdf10_xml
Feed Description: Just another this here thing blog.
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.