sqlite/stmt
src/sqlite/stmt.tur
defn
stmt-step
(stmt-step [stmt :int] :int)
advance a prepared statement to the next result row.
Parameters
| stmt | statement handle (opaque :int from db-prepare) |
Returns
1 if a row is available, 0 if execution is complete, -1 on error.
Example
(while (= 1 (stmt-step stmt)) (process-row stmt))
Since: P2
defn
stmt-bind-int
(stmt-bind-int [stmt :int i :int value :int] :bool)
bind a 64-bit integer to a statement parameter (1-indexed).
Parameters
| stmt | statement handle | |
| i | 1-based parameter index | |
| value | integer value to bind |
Returns
true on success, false on error.
Example
(stmt-bind-int stmt 1 42)
Since: P2
defn
stmt-bind-real
(stmt-bind-real [stmt :int i :int value :float] :bool)
bind a double to a statement parameter (1-indexed).
Parameters
| stmt | statement handle | |
| i | 1-based parameter index | |
| value | double value to bind |
Returns
true on success, false on error.
Example
(stmt-bind-real stmt 1 3.14)
Since: P2
defn
stmt-bind-text
(stmt-bind-text [stmt :int i :int value :cstr] :bool)
bind a text string to a statement parameter (1-indexed).
Parameters
| stmt | statement handle | |
| i | 1-based parameter index | |
| value | NUL-terminated string to bind (copied by SQLite) |
Returns
true on success, false on error.
Example
(stmt-bind-text stmt 1 "Alice")
Since: P2
defn
stmt-bind-null
(stmt-bind-null [stmt :int i :int] :bool)
bind a SQL NULL to a statement parameter (1-indexed).
Parameters
| stmt | statement handle | |
| i | 1-based parameter index |
Returns
true on success, false on error.
Example
(stmt-bind-null stmt 2)
Since: P2
defn
stmt-reset
(stmt-reset [stmt :int] :bool)
reset a prepared statement so it can be re-executed.
Parameters
| stmt | statement handle |
Returns
true on success, false on error.
Example
(stmt-reset stmt)
Since: P2
defn
stmt-finalize
(stmt-finalize [stmt :int] :bool)
finalize and free a prepared statement.
Parameters
| stmt | statement handle |
Returns
true always.
Example
(stmt-finalize stmt)
Since: P2