sqlite3pth

Overview

Requirements

sql-null, pthreads, srfi-18, srfi-34, llrb-tree, miscmacros, srfi-1

API

[procedure] (:sql-result: string --> (or false fixnum))

convert field name to index

[procedure] (: sqlite3-prepare ((struct <sqlite3-database>) string --> (struct <sqlite3-statement>)))

Prepare query.

[procedure] (: sqlite3-exec ((struct <sqlite3-database>) (or string (struct <sqlite3-statement>)) #!rest -> :sql-result:))

Execute statement or prepared query.

[procedure] (: sqlite3-call-with-transaction ((struct <sqlite3-database>) (procedure ((procedure (string #!rest) :sql-result:)) :sql-result:) -> :sql-result:))

Call procedure in a sqlite transaction.

[procedure] sqlite3-call-test/set

questionable, undocumented

[procedure] (: sqlite3-close ((struct <sqlite3-database>) -> . *))

Close database.

[procedure] sqlite3-interrupt!

Call sqlite_interrupt to abort running query.

[procedure] sql-result?

Test predicate for the sql result type.

[procedure] (sql-value RESULT ROW FIELD) --> *

Result Accessor.

[procedure] (: sql-ref (:sql-result: (or boolean fixnum) (or boolean fixnum string symbol) --> *))
[procedure] (: sql-fold (:sql-result: (procedure ((procedure (fixnum) *) *) *) * -> *))

Fold procedure over results.

[procedure] sqlite3-open
[procedure] sqlite3-close
[procedure] (: sqlite3-open-restricted (string #!optional string vector --> (struct <sqlite3-database>)))

Restricted open optionally with VFS. SQL may not attach other files. optional string requests sqlite3 VFS, vector holds VFS callbacks

[procedure] (: sqlite3-open-restricted-ro (string #!optional string vector --> (struct <sqlite3-database>)))

Restricted open read only optionally with VFS. SQL may not attach other files. optional string requests sqlite3 VFS, vector holds VFS callbacks

Accessors

   sqlite3-database-name
   sqlite3-changes
   sqlite3-statement?
   sqlite3-statement-name
   sqlite3-error? sqlite3-error-code sqlite3-error-args
[procedure] sqlite3-error-db-locked?

debug aid

[procedure] (sqlite3-debug-statements FLAG)

Log queries.

VFS Interface

The VFS allows to call back to Chicken when sqlite need to read data.

This is currently only lightly documented in tests/run.scm.

Examples

   (define db (sqlite-open "path"))
   (sqlite3-exec db "select 1") ; 1
   (sqlite3-exec db (sqlite3-prepare db "select ?1") 1) ; 1

About this egg

Source Code

Currently maintained here at github.

Author

Jörg F. Wittenberger

License

BSD