API reference › @evolu/sqlite-wasm › c-api › sqlite3_serialize
function sqlite3_serialize(deps: SqliteWasmDep): {
(
db: SqliteDbPtr,
zSchema: 0 | CStringPtr,
piSize: 0 | WasmPtr,
mFlags: 0,
): 0 | SqliteOwnedPtr;
(
db: SqliteDbPtr,
zSchema: 0 | CStringPtr,
piSize: 0 | WasmPtr,
mFlags: number,
): 0 | WasmPtr;
};
Defined in: packages/sqlite-wasm/src/CApi.ts:1531
Copies a schema, NULL meaning main, into memory from sqlite3_malloc64 that the caller frees, writing its byte size as an 8-byte sqlite3_int64 to piSize unless NULL. An empty database first gets its first page from an empty write transaction. Pages are read through the pager, so an encrypted database comes out decrypted, and a page that fails to read comes out zero-filled. Returns NULL when out of memory, for an unknown schema or a database without pages, and with SQLITE_SERIALIZE_NOCOPY returns SQLite's own buffer of a deserialized database, or NULL, instead of a copy, which the caller must neither free nor modify. Only a call whose mFlags is 0 returns memory sqlite3_free accepts.
Wasm type i(iiii). Signature ["sqlite3_serialize", "*", "sqlite3*", "string", "*", "int"] from SQLite's table.