source: project/wiki/eggref/5/sqlite3pth @ 36409

Last change on this file since 36409 was 36409, checked in by svnwiki, 21 months ago

Anonymous wiki edit for IP [185.248.160.21]: Fix some markup.

File size: 2.9 KB
Line 
1== sqlite3pth
2
3== Overview
4
5* Run SQLite queries asynchronously in pthreads. Supports calling Scheme from SQLite's VFS to supply database block storage.
6
7* Offloads the SQL work to pthreads; the chicken thread is free to continue.
8
9* VFS support allows sqlite3 to call back into chicken to supply blocks of the data base. (This is a breakout from ball.askemos.org - where the VFS is used to implement versioning and replication of the databases.)
10
11* Safe to be used with CHICKEN's srfi-18 threads.  (I.e., does {{NOT}} use {{define-external}}.)
12
13== Requirements
14
15[[sql-null]], [[pthreads]], [[srfi-18]], [[srfi-34]], [[llrb-tree]], [[miscmacros]], [[srfi-1]]
16
17== API
18
19Currently only lightly documented at
20[[https://github.com/0-8-15/sqlite3pth/|documented here]] at github.
21
22<procedure>(:sql-result: string --> (or false fixnum))</procedure>
23convert field name to index
24<procedure>(: sqlite3-prepare ((struct <sqlite3-database>) string --> (struct <sqlite3-statement>)))</procedure>
25<procedure>(: sqlite3-exec ((struct <sqlite3-database>) (or string (struct <sqlite3-statement>)) #!rest -> :sql-result:))</procedure>
26<procedure>(: sqlite3-call-with-transaction
27       ((struct <sqlite3-database>)
28        (procedure ((procedure (string #!rest) :sql-result:)) :sql-result:)
29       -> :sql-result:))</procedure>
30<procedure>sqlite3-call-test/set</procedure>
31questionable, undocumented
32<procedure>(: sqlite3-close ((struct <sqlite3-database>) -> . *))</procedure>
33<procedure>sqlite3-interrupt!</procedure>
34<procedure>sql-result?</procedure>
35test result type
36<procedure>(sql-value RESULT ROW FIELD) --> *</procedure>
37
38<procedure>(: sql-ref (:sql-result: (or boolean fixnum) (or boolean fixnum string symbol) --> *))</procedure>
39<procedure>(: sql-fold (:sql-result: (procedure ((procedure (fixnum) *) *) *) * -> *))</procedure>
40
41<procedure>sqlite3-open</procedure>
42<procedure>sqlite3-close</procedure>
43<procedure>(: sqlite3-open-restricted (string #!optional string vector --> (struct <sqlite3-database>)))</procedure>
44Restricted open optionally with VFS.  SQL may not attach other files.
45optional string requests sqlite3 VFS, vector holds VFS callbacks
46
47<procedure>(: sqlite3-open-restricted-ro (string #!optional string vector --> (struct <sqlite3-database>)))</procedure>
48Restricted open read only optionally with VFS.  SQL may not attach other files.
49optional string requests sqlite3 VFS, vector holds VFS callbacks
50
51=== Accessors
52
53    sqlite3-database-name
54    sqlite3-changes
55    sqlite3-statement?
56    sqlite3-statement-name
57
58    sqlite3-error? sqlite3-error-code sqlite3-error-args
59<procedure>sqlite3-error-db-locked?
60
61=== debug aid
62<procedure>(sqlite3-debug-statements FLAG)
63
64Log queries.
65
66== Examples
67
68    (define db (sqlite-open "path"))
69    (sqlite3-exec db "select 1") ; 1
70    (sqlite3-exec db (sqlite3-prepare db "select ?1") 1) ; 1
71
72
73== About this egg
74
75=== Source Code
76
77Currently [[https://github.com/0-8-15/sqlite3pth/|maintained here]] at github.
78
79=== Author
80
81Jörg F. Wittenberger
82
83=== License
84
85BSD
Note: See TracBrowser for help on using the repository browser.