# wasm_sqlite

SQLite 3.54.1, compiled from the upstream amalgamation, running inside a
WebAssembly guest on erlang_wasm, with no NIF. SQL, prepared statements,
transactions, FTS5, JSON and R-tree, in rollback-journal mode. The guest is
prebuilt in `priv/wasm_sqlite.wasm`; `priv/BUILD-INFO` says what it was built
from.

```erlang
{ok, Db} = wasm_sqlite:open(#{storage => {wasm_storage_file, "data.sqlite"}}),
ok = wasm_sqlite:execute(Db, <<"CREATE TABLE items (id INTEGER PRIMARY KEY, value TEXT)">>, []),
{ok, []} = wasm_sqlite:query(Db, <<"SELECT * FROM items">>, []).
```

It is much slower than a NIF SQLite. Before you depend on it, read
[the SQLite guide](https://github.com/benoitc/wasm_storage/blob/main/docs/sqlite.md) for the build options and the
journal mode, [what an error means](https://github.com/benoitc/wasm_storage/blob/main/docs/failures.md) and
[the project's status](https://github.com/benoitc/wasm_storage/blob/main/docs/status.md).
