better-sqlite3
better-sqlite3 copied to clipboard
feat: support connection flags
Rough patch that adds a constructor option for passing flags to sqlite3_open_v2. This would enable several situations listed in #483, like using a URI, without needing a custom build.
const Database = require('better-sqlite3');
const db = new Database('file:foobar.db', { flags: Database.Constants.OPEN_URI });
Relevant SQLITE_OPEN_* constants are exposed through Database.Constants (in case non-opening constants want to be exposed later).
API feels weird, would like some feedback on that.
EDIT: forgot SQLITE_OMIT_SHARED_CACHE removes shared cache support, removing that reference...
I would rather just provide a named option, since it provides a simpler interface for users of the library. For example, you can already do { readonly: true }.