-
-
Notifications
You must be signed in to change notification settings - Fork 399
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unable to open an existing database into memory via buffer #1066
Comments
Your code works fine for me: import Database from "better-sqlite3";
const db = new Database("./test.db", {
verbose: console.log,
readonly: true,
});
const buffer = db.serialize();
db.close();
const HUB_DB = new Database(buffer);
const statement = HUB_DB.prepare('select * from test');
console.log(statement.all()); So the issue lies somewhere in the code you didn't share. Please provide a minimal self contained example that demonstrates the issue. Your stack trace also doesn't align with the code you've provided ( |
I am also having this issue. Mine seems to be related to the sqlite-vss extension. Repro Script
Outcome
Further context
Schema for creating test.db
Code that created my test.db using VSS:
Thanks for any advice you might have |
Hi, unsure if you ever worked this out, but I was able to solve my case so I will put it here for future googlers: Your example code doesn't mention the recommended WAL journaling pragma, but if the saved db file has WAL enabled, it is not supported by
VSS extension works with it just fine too. Hope this helps! |
Hi everyone, I am really not sure what's going on, but I am trying to load a database file into memory by using the provided example of serializing the database into a buffer. I've tried all possible combinations of options, including reading a file with node FS module, but no luck.
This code works if we are just returning the Database as a file reference. DB loading code:
And usage code, where it fails:
The error is:
The text was updated successfully, but these errors were encountered: