Skip to content

Serialization -> Deserialization could have better error messages #1291

@lukeschaefer

Description

@lukeschaefer

For performance reasons, I'd like to do a number of large operations in memory, rather than interacting with the disk. This succeeds in creating an in-memory db: const db = new Database(':memory:');

However if I want to take an existing db and fully bring it into memory, this fails:

const db = new Database("./snapshot.db");
const buffer = db.serialize();
const inMemoryDb = new Database(buffer);
// Failure occurs on the next line:
inMemoryDb.prepare("SELECT phrase FROM Phrases");

I get SqliteError: unable to open database file. I can confirm the buffer is filled with data that can be written to disk and loaded via the filesystem like usual. But creating a Database out of a buffer seems to always result in a failure.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions