Repository navigation
fix(utils/parseExecute): normalize sparse prepared parameters - #296
Closed
SimpleModder wants to merge 1 commit into
Closed
SimpleModder wants to merge 1 commit into
SimpleModder wants to merge 1 commit into
Conversation
Member
|
The issue is that the build has not included the necessary patches to mysql2 which rebind undefined parameters to null. |
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.
Problem
Prepared execution can pass an interior sparse positional value to mysql2 as
undefined, which the driver rejects instead of binding SQLNULL.A real reproducer is Ox Inventory 2.48.0: Inventory.Save represents an empty player inventory as Lua
nil, and db.savePlayer calls:The missing first value should bind NULL. Instead, the save raises
Bind parameters must not contain undefined. To pass SQL NULL specify JS null. Because Inventory.Remove saves before clearing its entry, this also interrupts logout cleanup.The independent parser regression uses a genuine hole:
On unmodified v2.14.2 (
286b8a28eed23203886d7c43bfec3f7cab19d6ad), this returns[[undefined, 'citizen-A']].Fix
Move the existing indexed undefined-to-null normalization after row-shape conversion, applying it to flat and batch rows. The previous object-batch-only loop missed flat-array holes; rawExecute's trailing padding does not repair a hole inside the existing row length.
Only positions corresponding to placeholders are normalized. Explicit null, 0, false, empty strings, ordering and excess-parameter behavior are preserved. Eight regression tests cover sparse/undefined flat and batch values, short rows, falsey values, mixed object/array batches and excess entries. The diff contains only the parser and its unit-test file; no dependency or generated-artifact changes.
Validation
Revalidated on Windows with Bun 1.4.2 and Node 24.16.0:
bun install --frozen-lockfile --linker isolated; lockfile unchanged.oxfmt --checkandbun run buildpassed, including the library TypeScript compilation.bun run test:coverageexits 1 on both baseline and patch: unchanged profiler coverage is 80% functions / 82.76% lines, below the existing 85% threshold. Additional root/source TypeScript checks also reproduce identical baseline diagnostics. These checks are not claimed passing; thresholds and type configuration are unchanged.