sqlite3 and OpenBSD

Machine-specific discussion
Unix, Linux, OS X, OS/2, Windows, ..?
Locked
jsf
Posts: 2
Joined: Tue Jan 18, 2005 1:37 am
Location: USA
Contact:

sqlite3 and OpenBSD

Post by jsf »

I am trying to get SQLite working on OpenBSD 3.6 or 3.7-CURRENT.

I have compiled sqlite 3.2.1 with the --enable-shared option (using configure) which results in a file /usr/local/lib/libsqlite.so.8.6

Whenever I load the sqlite.lsp program, I get the following error message:

Code: Select all

Can't open file
problem loading library in function import : "/usr/local/lib/libsqlite.so.8.6"
When I try from the newlisp commandline to load the .so file with sqlite3_open as a function, I get the following:

Code: Select all

(load "/usr/local/lib/libsqlite.so.8.6" "sqlite3_open" "cdecl")
nil
At this point, I haven't tried extremely hard to figure out what is happening and thought I'd post to the list to see if anyone else has seen this behavior. In theory, this should work just fine, but it doesn't.

I've considering trying the SQLite 2.x series, but would prefer to run 3.1 or higher for some functionality I would like to use.

Any ideas from someone who has made this work?


As a side-note, the sql function/define fails on OS X when attempting to perform any sql command:

Code: Select all

 
> (sql3 "select * from mytable;")

invalid function : (sql3 "select * from mytable;")
Perhaps I'm just tired, but this should work based on the documentation (in the sqlite3.lsp file), which states:
;; (sql3 "select * from mytable;") ; makes a sql query, returns result
Username is "kanen"
(this account is not being used)

Lutz
Posts: 5289
Joined: Thu Sep 26, 2002 4:45 pm
Location: Pasadena, California
Contact:

Post by Lutz »

(1) when compiling do not use the --enable_shared option. Just do a

./configure
make

you will find libsqlite3.so.8 in $(HOME)/sqlite/.libs/

(2) use

(sql3:sql "select * from mytable;")

That is an error in the doc header. All commands have to be prefixed with:

(sql3:xxx ...)

When you can load the library correctly and changed sqlite3.lsp to the correct library location you should be able to execute the test routines contained:

Code: Select all

> newlisp sqlite3.lsp

newLISP v.8.5.4 on BSD, execute 'newlisp -h' for more info.

> (test-sqlite3)
database opened/created,  ... Ok
created table fruits,  ... Ok
inserted, last row id: 1,  ... Ok
inserted, last row id: 2,  ... Ok
inserted, last row id: 3,  ... Ok
selected rows: (("apples" 11) ("oranges" 22) ("bananas" 33)),  ... Ok
deleted, rows affected: 3,  ... Ok
tables: ("fruits"), ... Ok
columns: ("name" "qty"), ... Ok
table fruits dropped,  ... Ok
true
>
Lutz

ps: The code for importing a library is (import ...) not (load ...)

Locked