Repository navigation
bridge: bind positional exec params by number - #5
Merged
sputn1ck merged 1 commit intoJun 27, 2026
Merged
Conversation
runExec sent positional-array params to db.exec({ bind: [...] }), which
binds the array by SQLite slot order (order of first appearance) rather
than by the $N number. Statements whose $N appear out of textual order --
e.g. UPDATE ... SET col = $3 WHERE k = $1 -- therefore bound the WHERE
key against the wrong value and silently matched zero rows.
runQuery already routes positional arrays through normalizePositionalParams
(added in "Fix numbered SQLite parameter binding"), which remaps each $N to
its slot by number. This applies the same remap on the exec path by sending
any non-empty params (array or object) through bindParams, leaving only the
empty-params case on db.exec.
Adds TestBrowserExecNumberedParamsOutOfOrderE2E covering the exec path; it
fails (0 rows updated) against the old worker and passes with this change.
The existing UPDATE...RETURNING test only exercised the query path.
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 #4.
runExecsent positional-array params todb.exec({ bind: [...] }), which binds the array by SQLite slot order (order of first appearance) rather than by the$Nnumber. Statements whose$Nappear out of textual order — e.g.UPDATE … SET col = $3 WHERE k = $1— therefore bound theWHEREkey against the wrong value and silently matched zero rows, with no error.runQueryalready routes positional arrays throughnormalizePositionalParams, which remaps each$Nto its slot by number. This change applies the same remap on the exec path: any non-empty params (array or object) now go throughbindParams, leaving only the empty-params case ondb.exec. So numbered parameters are now honored consistently acrossQueryandExec.Test
Adds
TestBrowserExecNumberedParamsOutOfOrderE2E, which exercises the exec path with out-of-order numbered params (UPDATE … SET v=$2 WHERE id=$1). It fails against the old worker (0 rows updated) and passes with this change. The existingUPDATE … RETURNINGtest only covered the query path, which is why this slipped through.Changes
bridge/sqlite-worker.js(+12/-4) — route non-empty exec params throughbindParams.driver_browser_js_wasm_test.go(+80) — exec-path regression test.