sqlite.bend relies on unsafe/foreign
raw source on the hub · import bend-kit-sqlite@0.1.0.0/sqlite.bend as Sqlite
Prepared SQLite statements through libsqlite3. Source: https://github.com/paymog/bend-kit/tree/main/sqlite
1 import
import Base
Effects (foreign code)
effect db.open source · line 7 · raw
@path:String -> IO(Result<&1, &1, Pair(U32, String), U32>)
Handles are opaque U32 IDs. Close each database after finalizing all its statements. Every effect returns (SQLite error code, message) on failure. BEND_LIBSQLITE selects a custom libsqlite3 path.
foreign: effs/sqlite.c, effs/sqlite.js
effect db.close source · line 11 · raw
@db:U32 -> IO(Result<&1, &1, Pair(U32, String), Unit>)
foreign: effs/sqlite.c, effs/sqlite.js
effect stmt.prepare source · line 16 · raw
@db:U32 -> @sql:String -> IO(Result<&1, &1, Pair(U32, String), U32>)
Exactly one SQL statement is accepted; use bind operations for values.
foreign: effs/sqlite.c, effs/sqlite.js
effect stmt.finalize source · line 20 · raw
@stmt:U32 -> IO(Result<&1, &1, Pair(U32, String), Unit>)
foreign: effs/sqlite.c, effs/sqlite.js
effect stmt.bind.int source · line 25 · raw
@stmt:U32 -> @index:U32 -> @value:U32 -> IO(Result<&1, &1, Pair(U32, String), Unit>)
Bind positions start at 1. Integer values are unsigned 32-bit.
foreign: effs/sqlite.c, effs/sqlite.js
effect stmt.bind.text source · line 29 · raw
@stmt:U32 -> @index:U32 -> @text:String -> IO(Result<&1, &1, Pair(U32, String), Unit>)
foreign: effs/sqlite.c, effs/sqlite.js
effect stmt.bind.null source · line 33 · raw
@stmt:U32 -> @index:U32 -> IO(Result<&1, &1, Pair(U32, String), Unit>)
foreign: effs/sqlite.c, effs/sqlite.js
effect stmt.bind.blob source · line 38 · raw
@stmt:U32 -> @index:U32 -> @len:U32 -> @words:Array<U32> -> IO(Result<&1, &1, Pair(U32, String), Unit>)
Blob octets are packed four per U32, least-significant byte first.
foreign: effs/sqlite.c, effs/sqlite.js
effect stmt.step source · line 43 · raw
@stmt:U32 -> IO(Result<&1, &1, Pair(U32, String), Bool>)
True means a row is available; False means no more rows.
foreign: effs/sqlite.c, effs/sqlite.js
effect stmt.reset source · line 47 · raw
@stmt:U32 -> IO(Result<&1, &1, Pair(U32, String), Unit>)
foreign: effs/sqlite.c, effs/sqlite.js
effect stmt.column.kind source · line 53 · raw
@stmt:U32 -> @index:U32 -> IO(Result<&1, &1, Pair(U32, String), U32>)
Column indexes start at 0. Read columns only after a True step. SQLite kinds: 1 integer, 2 float, 3 text, 4 blob, 5 null.
foreign: effs/sqlite.c, effs/sqlite.js
effect stmt.column.int source · line 57 · raw
@stmt:U32 -> @index:U32 -> IO(Result<&1, &1, Pair(U32, String), U32>)
foreign: effs/sqlite.c, effs/sqlite.js
effect stmt.column.text source · line 61 · raw
@stmt:U32 -> @index:U32 -> IO(Result<&1, &1, Pair(U32, String), String>)
foreign: effs/sqlite.c, effs/sqlite.js
effect stmt.column.blob source · line 65 · raw
@stmt:U32 -> @index:U32 -> IO(Result<&1, &1, Pair(U32, String), Pair(U32, Array<U32>)>)
foreign: effs/sqlite.c, effs/sqlite.js