Title: sqlite: db.prepare(sql, options) · Issue #61235 · nodejs/node · GitHub
Open Graph Title: sqlite: db.prepare(sql, options) · Issue #61235 · nodejs/node
X Title: sqlite: db.prepare(sql, options) · Issue #61235 · nodejs/node
Description: Problem Currently you need multiple js statements to declare a single SQLite statement with options like returnArrays, readBigInts etc. This requires multiple lines and can be inefficient to call c++ multiple times: const q = db.prepare(...
Open Graph Description: Problem Currently you need multiple js statements to declare a single SQLite statement with options like returnArrays, readBigInts etc. This requires multiple lines and can be inefficient to call c...
X Description: Problem Currently you need multiple js statements to declare a single SQLite statement with options like returnArrays, readBigInts etc. This requires multiple lines and can be inefficient to call c...
Opengraph URL: https://github.com/nodejs/node/issues/61235
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"sqlite: db.prepare(sql, options)","articleBody":"# Problem\n\nCurrently you need multiple js statements to declare a single [SQLite](https://nodejs.org/api/sqlite.html) statement with options like `returnArrays`, `readBigInts` etc. This requires multiple lines and can be inefficient to call c++ multiple times:\n\n```js\n\nconst q = db.prepare(sql);\nq.setReturnArrays(true);\nq.setReadBigInts(true);\nq.setAllowBareNamedParameters(true);\nq.setAllowUnknownNamedParameters(true);\n```\n\n# Proposal 1\n\nAllow chaining `statement.set*` functions by returning the sql statement instead of `undefined`. 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 existing `set*` functions:\n\n```js\n// before\nconst q = db.prepare(sql);\nq.setReturnArrays(true);\n\n// after\nconst q = db.prepare(sql).setReturnArrays(true);\n\n// more example\nconst q = db.prepare(sql).setReturnArrays(true).setReadBigInts(true);\n```\nPR: https://github.com/nodejs/node/pull/61263\n\n# Proposal 2\n\nAdd options argument: `db.prepare(sql[, options])`\n\n```js\n// before\nconst q = db.prepare(sql);\nq.setReturnArrays(true);\n\n// after\nconst q = db.prepare(sql, { returnArrays: true });\n\n// more example\nconst q = db.prepare(sql, { returnArrays: true, readBigInts: true });\n\n```\nIn this case I recommend to remove the `statement.set*` functions to simplify the API, you only need `db.prepare(sql[, options])`\n\n# Proposal 3\n\nDo both Proposal 1 and Proposal 2. Currently I am leaning towards Proposal 2 and removing set* functions","author":{"url":"https://github.com/mike-git374","@type":"Person","name":"mike-git374"},"datePublished":"2026-01-01T16:56:55.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":4},"url":"https://github.com/61235/node/issues/61235"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:2b8ba7c8-6109-8cd8-89a3-1a73ab6faad8 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | A380:43C9:3AFAF:4AC54:6A4D3EC0 |
| html-safe-nonce | 045664a15ef3db3e1db32bc3905944a14e55ca69f850703d6720bf578bdd5dfc |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBMzgwOjQzQzk6M0FGQUY6NEFDNTQ6NkE0RDNFQzAiLCJ2aXNpdG9yX2lkIjoiNDAxMTMxMzMyODQxNTg2MzY4IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | f145e91f2575868759e6a60b0b267287cf8bc81ec31c2c8b9f400a322b315d37 |
| hovercard-subject-tag | issue:3774904083 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/nodejs/node/61235/issue_layout |
| twitter:image | https://opengraph.githubassets.com/0178db86c6f3a93c82d38cc39b5a5f06f39dc5f0b1799404c0b5506880a201cb/nodejs/node/issues/61235 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/0178db86c6f3a93c82d38cc39b5a5f06f39dc5f0b1799404c0b5506880a201cb/nodejs/node/issues/61235 |
| og:image:alt | Problem Currently you need multiple js statements to declare a single SQLite statement with options like returnArrays, readBigInts etc. This requires multiple lines and can be inefficient to call c... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | mike-git374 |
| hostname | github.com |
| expected-hostname | github.com |
| None | 92571a8944142227b7e19cd10918b1ddd06e5066c1ad5bc7e4769cf6140a87e6 |
| turbo-cache-control | no-preview |
| go-import | github.com/nodejs/node git https://github.com/nodejs/node.git |
| octolytics-dimension-user_id | 9950313 |
| octolytics-dimension-user_login | nodejs |
| octolytics-dimension-repository_id | 27193779 |
| octolytics-dimension-repository_nwo | nodejs/node |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 27193779 |
| octolytics-dimension-repository_network_root_nwo | nodejs/node |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 56fc8347865a14e2ec811533d68f929cf4e0ec19 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width