[API reference](https://evolu.dev/docs/api-reference) › [@evolu/sqlite-wasm](https://evolu.dev/docs/api-reference/sqlite-wasm) › [c-api](https://evolu.dev/docs/api-reference/sqlite-wasm/c-api) › sqlite3\_prepare\_v2

```ts
function sqlite3_prepare_v2(
  deps: SqliteWasmDep,
): (
  db: SqliteDbPtr,
  zSql: WasmPtr,
  nByte: number,
  ppStmt: WasmPtr,
  pzTail: 0 | WasmPtr,
) => SqliteResultCode;
```

Defined in: [packages/sqlite-wasm/src/CApi.ts:1808](https://github.com/evoluhq/evolu/blob/bc4578a260dd15d5bbf94b83765ca05984d194cb/packages/sqlite-wasm/src/CApi.ts#L1808)

Compiles the first statement of UTF-8 SQL as [sqlite3\_prepare\_v3](https://evolu.dev/docs/api-reference/sqlite-wasm/c-api/functions/sqlite3_prepare_v3) does
with no flags, reading at most nByte bytes or up to a NUL when nByte is
negative, and writes the statement to `*ppStmt` and the address of the
uncompiled rest to `*pzTail`. `*ppStmt` is NULL on error and for SQL without
a statement, such as only a comment; the caller finalizes a non-NULL one.

Wasm type `i(iiiii)`. Signature `["sqlite3_prepare_v2", "int", "sqlite3*",
"*", "int", "**", "**"]` from Evolu's supplement: SQLite binds it by hand to
accept JavaScript strings.

See https://sqlite.org/c3ref/prepare.html.