-
-
Notifications
You must be signed in to change notification settings - Fork 35.3k
sqlite: add DatabaseSync.prototype.pragma() #62722
Copy link
Copy link
Open
Labels
discussIssues opened for discussions and feedbacks.Issues opened for discussions and feedbacks.feature requestIssues that request new features to be added to Node.js.Issues that request new features to be added to Node.js.sqliteIssues and PRs related to the SQLite subsystem.Issues and PRs related to the SQLite subsystem.
Metadata
Metadata
Assignees
Labels
discussIssues opened for discussions and feedbacks.Issues opened for discussions and feedbacks.feature requestIssues that request new features to be added to Node.js.Issues that request new features to be added to Node.js.sqliteIssues and PRs related to the SQLite subsystem.Issues and PRs related to the SQLite subsystem.
Type
Projects
Status
Awaiting Triage
What is the problem this feature will solve?
node:sqlitealready supports PRAGMA statements through raw SQL but using them is more awkward than it needs to be.Today users need to know which API shape to use for each case:
This works, but it is not very discoverable and it forces users to switch between exec(), get() and all()
A dedicated pragma() helper would make common sqlite configuration and introspection easier to read, easier to teach and closer to what users may already expect from libraries like better-sqlite3.
What is the feature you are proposing to solve the problem?
Add a database.pragma() helper to node:sqlite, initially on DatabaseSync.
Example shape:
Possible behavior mimicking popular libraries:
This would be an ergonomic wrapper over functionality that already exists via raw SQL, not a new SQLite capability.
What alternatives have you considered?
This works today but it is more verbose and requires users to remember which call shape matches each PRAGMA use case.