Repository navigation
feat(ts): bind parameters in query - #1578
Merged
Merged
Conversation
The napi query and queryOrdered take no params yet, so every new test fails on the placeholders left unbound or the params never forwarded.
An array fills ? placeholders and a plain object fills :name, @name and $name placeholders, through SQLite's own binding, in query and queryOrdered. Values that cannot bind reject with a TypeError, or a RangeError for a bigint outside 64 bits.
thekevinscott
marked this pull request as ready for review
November 4, 2026 16:59
thekevinscott
enabled auto-merge
November 4, 2026 16:59
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1575
TypeScript
query(sql, params?)andqueryOrdered(sql, params?)bind parameters through SQLite, matching the Python and Rust support from #1576. An array fills?. A plain object fills:name/@name/$name, keyed without the prefix. Supported values:null,number(an integral value binds as INTEGER, any other as REAL),bigintwithin i64,boolean(0/1),string, andBuffer/Uint8Array. Any other value,undefinedincluded, rejects with aTypeError; abigintoutside i64 rejects with aRangeError. Params that are neither an array nor a plain object reject with aTypeError. Count, name and style mismatches surface the core'sDbError::Paramsmessage.Red
Commit
276896b9(tests only) went red in CI for the asserted reasons: https://github.com/thekevinscott/dirsql/actions/runs/41870669827query-paramstests failed because the params were never bound (the query has 2 parameter(s), but 0 value(s) were given, etc.).query/queryOrderedtook 1 argument.Parity
Restores parity.
PARITY.mddrops the TypeScript "Missing" entry for bind parameters.E2E Verification
packages/tschanged)tests/e2e/query-params.test.ts)packages/python/e2e-attestations/<branch>.jsonreceipt written ifpackages/pythonchanged: N/Apackages/ts/e2e-attestations/<branch>.jsonreceipt written ifpackages/tschanged (just e2e-attest-ts)just e2e-attest-ts;just preflight --gate colocated-test --gate one-function-per-file --gate unit-lint --gate integration-lint --gate unit-coverage --gate packaging --gate e2e-verify(0 failing)dist/index.js:query("... = :v", { v: "O'Brien'; DROP TABLE t; --" })returns onlya.json.queryOrdered("SELECT ? AS b, ? AS a, typeof(?) AS t", [1, 2.5, 3n])returns columnsb,a,twitht: 'integer'.[undefined]throwsTypeError,"x"throwsTypeError,[2n ** 64n]throwsRangeError, and a count mismatch throwsErrorwith the core message.Changelog / Migrations
packages/ts/changelog.d/for each changed packagepackages/ts/migrations.d/for each changed package (every subsection but Summary_None._when nothing breaks)