fix(mysql): display BIT field values as decimal instead of hex bytes#1273
Merged
datlechin merged 2 commits intoMay 15, 2026
Merged
Conversation
MySQL bit(1) fields were incorrectly treated as binary data, causing values like 0x01 to display as "^A" (control character). This change: - Removes MYSQL_TYPE_BIT (16) from the binary classification logic in MariaDBFieldClassifier.isBinary(), since BIT is not truly binary - Adds MariaDBFieldClassifier.isBit() to detect BIT type fields - Adds bitFieldToString() to convert the packed binary representation (MSB-first) into a human-readable decimal string - Propagates columnIsBit through all three query execution paths (sync, prepared statements, streaming) Fixes TableProApp#1272
Contributor
|
All contributors have signed the CLA ✍️ ✅ |
Contributor
Author
|
I have read the CLA Document and I hereby sign the CLA. |
- Move bitFieldToString into MariaDBFieldClassifier so the BIT decode helper lives with the BIT detector. - Drop the columnIsBit: [Bool] parallel array threaded through MariaDBPluginQueryResult, the three query paths, and fetchResultSet. The type code in columnTypes[i] is sufficient and MariaDBFieldClassifier.isBit(typeRaw:) is O(1). - Fix MariaDBFieldClassifierTests.bitIsBinary which asserted the old (broken) behavior. Replace with bitIsNotBinary and add coverage for isBit and bitFieldToString across 1-byte, multi-byte, BIT(64) max, empty buffer, and the Data overload. - Add CHANGELOG entry under [Unreleased] > Fixed.
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.
Summary
MySQL
bit(1)fields were incorrectly treated as binary data, causing values like0x01to display as^A(control character).Root Cause
MariaDBFieldClassifier.isBinary()returnedtrueforMYSQL_TYPE_BIT(type code 16), treating bit fields as binary blobsBlobFormattingServiceand displayed as hex, showing control charactersFix
MYSQL_TYPE_BITfrom binary classification inMariaDBFieldClassifierisBit()detection andbitFieldToString()to convert packed binary representation to decimal stringcolumnIsBitthrough all three query execution paths (sync, prepared statements, streaming)Result
del_flagvalues now display as0/1instead of^A/^@Fixes #1272