import { SQLiteClient } from "https://deno.land/x/nessie@2.0.11/deps.ts";
Deserialize a database.
The format is the same as would be read from disk when opening a database from a file.
When the database is deserialized, the contents of
the passed data
buffer are copied.
Examples
Replace the default (main
) database schema
with the contents from data
.
db.deserialize(data);
Create an in-memory database from a buffer.
const db = new DB();
db.deserialize(data);
Deserialize data
as a read-only database.
db.deserialize(data, { mode: "read" });
Specify a schema name different from main
.
Note that it is not possible to deserialize into
the temp
database.
db.execute("ATTACH DATABASE ':memory:' AS other"); // create schema 'other'
db.deserialize(data, { schema: "other" });
For more details see https://www.sqlite.org/c3ref/deserialize.html and https://www.sqlite.org/lang_attach.html.