Repository navigation
sqlite: db.prepare(sql, options) #61235
Copy link
Copy link
Closed
Labels
feature requestIssues requesting new Node.js features.Issues requesting new Node.js features.sqliteIssues and PRs related to the SQLite subsystem.Issues and PRs related to the SQLite subsystem.
Description
Activity
- addedfeature requestIssues requesting new Node.js features.Issues requesting new Node.js features.
on Jan 1, 2026 - changed the title
[-]sqlite `db.prepare(sql).set*` should return statement for chaining[/-][+]sqlite: add `db.prepare(sql, options)` options object[/+]on Jan 1, 2026 - changed the title
[-]sqlite: add `db.prepare(sql, options)` options object[/-][+]sqlite: add `db.prepare(sql, options)`[/+]on Jan 1, 2026 - changed the title
[-]sqlite: add `db.prepare(sql, options)`[/-][+]sqlite: `db.prepare(sql, options)`[/+]on Jan 1, 2026 - changed the title
[-]sqlite: `db.prepare(sql, options)`[/-][+]sqlite: `db.prepare(sql).set*` chain[/+]on Jan 1, 2026 I think your original proposal (an options argument to
db.prepare()) is more consistent with existing node:sqlite patterns, and with Node.js conventions on the whole. That being said, is your usage case already covered by passing defaults to the DatabaseSync constructor?- addedsqliteIssues and PRs related to the SQLite subsystem.Issues and PRs related to the SQLite subsystem.
on Jan 2, 2026 - changed the title
[-]sqlite: `db.prepare(sql).set*` chain[/-][+]sqlite: multiple JS statements needed to declare 1 sql statement[/+]on Jan 4, 2026 - changed the title
[-]sqlite: multiple JS statements needed to declare 1 sql statement[/-][+]sqlite: `db.prepare(sql[, options])`[/+]on Jan 4, 2026 - changed the title
[-]sqlite: `db.prepare(sql[, options])`[/-][+]sqlite: db.prepare(sql, options)[/+]on Jan 4, 2026 Go for proposal 2.
Reacted by René, mike-git374 and Bart LouwersI'm interested in implementing this. Can I take this on?
While this issue is open anyone can open a PR, thanks
Metadata
Metadata
Assignees
Labels
feature requestIssues requesting new Node.js features.Issues requesting new Node.js features.sqliteIssues and PRs related to the SQLite subsystem.Issues and PRs related to the SQLite subsystem.
Type
Projects
- StatusShow more project fieldsAwaiting Triage
Problem
Currently you need multiple js statements to declare a single SQLite statement with options like
returnArrays,readBigIntsetc. This requires multiple lines and can be inefficient to call c++ multiple times:Proposal 1
Allow chaining
statement.set*functions by returning the sql statement instead ofundefined. This allows declaring a sql statement with 1 JS statement. This still requires multiple function calls but is slightly better DX developer experience using the existingset*functions:PR: #61263
Proposal 2
Add options argument:
db.prepare(sql[, options])In this case I recommend to remove the
statement.set*functions to simplify the API, you only needdb.prepare(sql[, options])Proposal 3
Do both Proposal 1 and Proposal 2. Currently I am leaning towards Proposal 2 and removing set* functions