Skip to content
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

feat: support connection flags #735

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

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