newLISP Fan Club

Forum => newLISP and the O.S. => Topic started by: jsf on April 23, 2005, 11:25:20 PM

Title: sqlite3 and OpenBSD
Post by: jsf on April 23, 2005, 11:25:20 PM
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:



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:



(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:



> (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:


Quote
;; (sql3 "select * from mytable;")  ; makes a sql query, returns result
Title:
Post by: Lutz on April 24, 2005, 06:18:57 AM
(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:



> 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 ...)