Download ASDF package from http://clisp-sqlite.googlecode.com/files/clisp-sqlite_1.0.tar.gz
sqlite_open database-name-string mode
=> (values database-pointer nil)sqlite_close database-pointer => (values)sqlite_exec database-pointer sql-string callback
nil => (values error-code error-message)sqlite_last_insert_rowid database-pointer
=> last-inserted-row-idsqlite_changes database-pointer => rows-modified-or-deleted-or-insertedsqlite::database object. You can extract the wrapped
database pointer with sqlite::database-address if you
really want it, but it's best not to mix calls between functions from
the sqlite and sqlite.raw packages.
sqlite-open filename
=> open-db-objectsqlite-close db-object
=> closed-db-objectsqlite-open.
with-open-db (db-var filename)
&body bodysqlite-exec db-object query-string callback
&optional argument => tsqlite_exec,
except that t is returned in normal cases. In
exceptional cases, an error is raised instead.
sql db-object sql-query
=> sql-resultwith-query (db-object
(arg-0...arg-n) sql-query-format-template
&rest query-format-template-args)
&body bodyformat to the format template and the
template args, that way your query can be computed dynamically.
As each row is returned, each column is bound to the corresponding
variable named in arg-*. Then the body is evaluated. It
could probably stand some optimization. Here's an example:
(with-open-db (db #"foo.db")
(with-query (db (id name email) "select id, name, email from student where grade=~s" 12)
(format t "~s ~s ~s~%" id name email)))
This page is linked from: SQLite Lisp interface
CLiki pages can be edited by anyone at any time. Imagine a fearsomely comprehensive disclaimer of liability. Now fear, comprehensively