wasm_sqlite_proto (wasm_sqlite v0.1.0)
View SourceEncodes requests to the SQLite guest and decodes its responses: the Erlang
half of engines/sqlite/src/abi.c, described in docs/abi.md.
Values cross as: null; an integer (64-bit signed); a float; a binary
(TEXT); {blob, Binary} (BLOB). {text, IoData} is accepted as a
parameter too.
Summary
Functions
Decode the body of a successful response to Op (not step).
Decode N rows of NCols values. Returns the rows (lists) and what follows
them. For step, the body is <<Done, N:32/little, Rows, State>>.
Decode the body of a step response, <<Done, N:32/little, Rows, State>>,
for a statement of NCols columns.
Whether an error means the guest's state can no longer be trusted.
The decoded response of an exec or a query that changed nothing and left
the connection free, as decode/2 would return it.
Encode statement parameters. Raises {badarg, {sqlite_value, V}} for a
value SQLite cannot hold: call it in the caller's process, so that a bad
argument fails there and not in the database process.
The atom of a SQLite result code, or of an ABI error.
Who needs the connection to themselves, from the state byte that ends a
response: transaction while one is open, statement while a write
statement is stepped part way (it holds back every other write's commit
until it is reset or done), free otherwise.
The connection state a step response ends with (state/1).
Types
Functions
Decode the body of a successful response to Op (not step).
Decode N rows of NCols values. Returns the rows (lists) and what follows
them. For step, the body is <<Done, N:32/little, Rows, State>>.
-spec decode_step(binary(), non_neg_integer()) -> map().
Decode the body of a step response, <<Done, N:32/little, Rows, State>>,
for a statement of NCols columns.
Whether an error means the guest's state can no longer be trusted.
-spec no_effect(exec | query) -> map().
The decoded response of an exec or a query that changed nothing and left
the connection free, as decode/2 would return it.
Encode statement parameters. Raises {badarg, {sqlite_value, V}} for a
value SQLite cannot hold: call it in the caller's process, so that a bad
argument fails there and not in the database process.
The atom of a SQLite result code, or of an ABI error.
-spec state(byte()) -> transaction | statement | free.
Who needs the connection to themselves, from the state byte that ends a
response: transaction while one is open, statement while a write
statement is stepped part way (it holds back every other write's commit
until it is reset or done), free otherwise.
-spec step_state(binary()) -> transaction | statement | free.
The connection state a step response ends with (state/1).