API reference › @evolu/sqlite-wasm › c-api › sqlite3_config

function sqlite3_config(
  deps: SqliteWasmDep,
): (...args: SqliteConfigArgs) => SqliteResultCode;

Defined in: packages/sqlite-wasm/src/CApi.ts:3201

Changes a global option of the library, which works only before sqlite3_initialize or after sqlite3_shutdown and otherwise returns SQLITE_MISUSE. The loader initializes the library, so call it after sqlite3_shutdown, then initialize the library again with initializeSqliteWasm, as sqlite3_shutdown explains.

  • SQLITE_CONFIG_MEMSTATUS, SQLITE_CONFIG_SMALL_MALLOC, SQLITE_CONFIG_URI and SQLITE_CONFIG_COVERING_INDEX_SCAN turn a feature on for a non-zero value and off for 0.
  • SQLITE_CONFIG_STMTJRNL_SPILL sets the byte size above which statement journals spill to disk. SQLITE_CONFIG_SORTERREF_SIZE fails with SQLITE_ERROR, since this build does not enable sorter references.
  • SQLITE_CONFIG_LOOKASIDE sets the default lookaside allocator of new connections to cnt slots of sz bytes.
  • SQLITE_CONFIG_MEMDB_MAXSIZE sets the default maximum size of a database sqlite3_deserialize creates.

The C function is variadic, so the binary does not export it. This calls the build's shim for the option's arguments and, as SQLite's JavaScript does, returns SQLITE_NOTFOUND for every other option without calling wasm, because the shims pass their arguments to the C function unchecked.

Calls the build's shims, whose signatures come from Evolu's metadata because SQLite's table omits them:

  • sqlite3__wasm_config_i, wasm type i(ii), signature ["sqlite3__wasm_config_i", "int", "int", "int"].
  • sqlite3__wasm_config_ii, wasm type i(iii), signature ["sqlite3__wasm_config_ii", "int", "int", "int", "int"].
  • sqlite3__wasm_config_j, wasm type i(ij), signature ["sqlite3__wasm_config_j", "int", "int", "i64"].

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