Skip to content

Conversation

abalabahaha
Copy link

@abalabahaha abalabahaha commented Dec 9, 2021

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...

@JoshuaWise
Copy link
Member

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 }.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

2 participants