Summary: A simple FFI wrapper for SQLite3 based on Avi Bryant's SQLite (v.2) wrapper
Author: Fred Mannby /cf ate mannby dote come/
Owner: Claes-Fredrik Mannby (cf)
Co-maintainers: <None>
Homepage: http://www.mindplus.com/squeak/sqlite3
PackageInfo name: SQLite3
RSS feed:


This is a first cut at an FFI wrapper for SQLite3 based on Avi Bryant's wrapper for SQLite version 2.

It requires the FFI plugin (SqueakFFIPrims), and SQLite3 (it comes with Tiger, but you can also get it and documentation from http://www.hwaci.com/sw/sqlite).

The wrapper has only been tested with Squeak 3.8 and Mac OS X Tiger (10.4.2). If there is a desire for it, I may try to make it work smoothly on other platforms. In order to load the library on Mac OS X, you should execute the following EXACT commands in the Terminal:

sudo mkdir /System/Library/Frameworks/libsqlite3.framework
sudo ln -s /usr/local/lib/libsqlite3.dylib /System/Library/Frameworks/libsqlite3.framework/libsqlite3

The wrapper is simply a modification of Avi's code, so they will not work side by side.

It passes Avi's test code for me:

con := SQLiteConnection fileNamed: 'test.db'.
con inspect.
s1 := 'create table employee (id, name)'.
s2 := 'insert into employee values (1, ''Adam'')'.
s3 := 'insert into employee values (2, ''Eve'')'.
with: s1
with: s2
with: s3)
do: [:sql | con execute executeQuery: sql].
arrayOfDicts := con executeQuery: 'SELECT * FROM employee'.
arrayOfDicts inspect.
con close.

Note that if you are having trouble getting FFI to find the library and functions, you may need to inspect SqliteLibrary, and set the default class variable default to nil and try again.