-
-
Notifications
You must be signed in to change notification settings - Fork 161
ext-mysql2: every prepared-statement parameter binds as NULL (#9310) #9319
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| Fix silent data loss in the bundled `mysql2` prepared-statement bridge. Perry | ||
| stores strings of at most five bytes in its inline SSO representation, but the | ||
| wrapper tested only for heap strings; every short string therefore fell into a | ||
| catch-all branch that deliberately emitted SQL NULL. A parameter list made of | ||
| short values and nulls arrived at MySQL as all nulls, while longer strings and | ||
| primitive numbers took their intended branches. | ||
|
|
||
| The bridge now accepts both Perry string representations without allocating in | ||
| the runtime heap and copies every parameter into an owned Rust value before | ||
| scheduling database work. Strings, integer and floating-point numbers, | ||
| booleans, null, Date, Buffer, and Uint8Array bind with their real values. An | ||
| undefined or unsupported parameter rejects the operation with an Error instead | ||
| of being rewritten to SQL NULL. Integer results are decoded with their actual | ||
| MySQL width and signedness, so a bound boolean no longer comes back as null. | ||
| Async `createConnection` and `getConnection` results preserve Perry's registry- | ||
| handle tag rather than returning an unusable ordinary number. | ||
|
|
||
| Coverage includes exact extraction assertions for every supported type and a | ||
| live-MySQL regression that checks the server-observed values at parameter counts | ||
| 3, 8, 12, and 17, plus Date and Buffer contents. The checks compare the full | ||
| values; a constant non-null substitute cannot pass them. |
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
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win
🔎 Supported by static analysis
🏁 Script executed:
Repository: PerryTS/perry
Length of output: 31239
🏁 Script executed:
Repository: PerryTS/perry
Length of output: 50370
Preserve
BIGINTprecision in both MySQL result decoders.Both
BIGINTbranches cast 64-bit values tof64, and both later create JavaScript numbers. Values outside the JavaScript safe-integer range can lose precision. Return an exact decimal string or runtimeBigInt, and add signed and unsigned regression tests.📍 Affects 2 files
crates/perry-ext-mysql2/src/lib.rs#L284-L290(this comment)crates/perry-stdlib/src/mysql2/result.rs#L178-L187🤖 Prompt for AI Agents