Skip to content

node:sqlite support SQLITE_OPEN_URI #57068

Description

@BurningEnlightenment

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.

Activity

  1. cjihrig commented on Feb 15, 2025

    @cjihrig
    Contributor

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

  2. BurningEnlightenment commented on Feb 15, 2025

    @BurningEnlightenment
    Author

    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.

  3. geeksilva97 commented on Feb 21, 2025

    @geeksilva97
    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

  4. BurningEnlightenment commented on Feb 21, 2025

    @BurningEnlightenment
    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🤔

  5. geeksilva97 commented on Mar 18, 2025

    @geeksilva97
    Contributor

    @BurningEnlightenment @cjihrig do you think we can close this issue since now, sqlite is accepting URL as database path and SQLITE_OPEN_URI is enabled?

    https://nodejs.org/en/blog/release/v23.10.0

  6. cjihrig commented on Mar 18, 2025

    @cjihrig
    Contributor

    I think so. Thanks!

  7. BurningEnlightenment commented on Mar 18, 2025

    @BurningEnlightenment
    Author

    Can this be backported to the next 22 release?

  8. geeksilva97 commented on Mar 18, 2025

    @geeksilva97
    Contributor

    Can this be backported to the next 22 release?

    Yeah, I think so. Let me open it.

  9. geeksilva97 commented on Mar 18, 2025

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature requestIssues requesting new Node.js features.

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions