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

node:sqlite support SQLITE_OPEN_URI #57068

Open
BurningEnlightenment opened this issue Feb 15, 2025 · 4 comments
Open

node:sqlite support SQLITE_OPEN_URI #57068

BurningEnlightenment opened this issue Feb 15, 2025 · 4 comments
Labels
feature request Issues that request new features to be added to Node.js.

Comments

@BurningEnlightenment
Copy link

What is the problem this feature will solve?

I have a custom SQLite VFS implementation and I want to open a database within the VFS. SQLite allows me to specify the VFS implementation as a query parameter for URI filenames.

What is the feature you are proposing to solve the problem?

Add an allowLocationUri boolean property to DatabaseSync#options which causes SQLITE_OPEN_URI to be passed to sqlite3_open_v2().

What alternatives have you considered?

  • Always pass SQLITE_OPEN_URI to sqlite3_open_v2() like go-sqlite3 or the rust bindings rusqlite do. Note that specifying SQLITE_OPEN_URI does not require location to be an URI.
  • Allow passing arbitrary open flags. node-sqlite3 chose this path.
@BurningEnlightenment BurningEnlightenment added the feature request Issues that request new features to be added to Node.js. label Feb 15, 2025
@github-project-automation github-project-automation bot moved this to Awaiting Triage in Node.js feature requests Feb 15, 2025
@cjihrig
Copy link
Contributor

cjihrig commented Feb 15, 2025

I think it makes sense to always pass SQLITE_OPEN_URI since Node.js tries to support URLs and file paths (related #56940).

@BurningEnlightenment
Copy link
Author

BurningEnlightenment commented Feb 15, 2025

I think it makes sense to always pass SQLITE_OPEN_URI since Node.js tries to support URLs and file paths

Would be totally fine by me. I proposed the conservative option mainly because I don't know how much you care about the overlap between URIs and valid filepaths on Linux and BSDs, e.g. file:///bin/sh could either mean /bin/sh or ./file:/bin/sh on Linux.

@geeksilva97
Copy link
Contributor

I think it makes sense to always pass SQLITE_OPEN_URI since Node.js tries to support URLs and file paths (related #56940).

Great! I took the opportunity to do this flag as default in that PR. It's ready for review

@BurningEnlightenment
Copy link
Author

Maybe it's worth to consider the fourth option: Pass SQLITE_OPEN_URI if and only if the user provided an URL object for location🤔

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request Issues that request new features to be added to Node.js.
Projects
Status: Awaiting Triage
Development

No branches or pull requests

3 participants