moondb

full moon · a statute of moondb

moonsqlite

The SQLite implementation of the Driver contract — embedded, serverless, and complete. The reference phase every other driver grows toward.

Enactment

What it is

moonsqlite embeds a SQLite database in-process and implements Driver against it. It speaks the ? placeholder token and binds parameters out-of-band.

i

Install

moon add moonbitstack/moonsqlite

ii

Placeholder

? positional — SQLite's native anonymous placeholder, bound through the prepared-statement API.

iii

Prepared handles

prepare compiles a sqlite3_stmt and keeps it: bind resets and rebinds, execute/query re-run the compiled program, and a :name statement is rewritten to ? at prepare time.

iv

Failures

SQLite reports a result code and nothing else, so the driver classifies it on the table Python's sqlite3 module uses: a constraint violation is Integrity, a malformed statement is Operational, a value bound to a slot the statement does not have is Interface. The extended code travels in ServerDetail.code, so 2067 (UNIQUE) and 1299 (NOT NULL) are distinguishable without reading a message.

v

On the js target

The same driver compiles for js over SQLite's own WebAssembly build. SqliteDriver keeps every method and the same Driver trait; open is the one difference, because instantiating a module is a promise. scripts/fetch_engine.sh fetches the build — the package never carries an engine.

vi

Coverage

execute query transaction close query_stream (steps its prepared statement) prepare dialect ping (default).

moonsqlite implements Driver placeholder ? backend SQLite (embedded)
See the family The contract it obeys