This repository was archived by the owner on Dec 13, 2022. It is now read-only.
Fix long VARCHAR and short STRING issues#4
Open
brunograsselli wants to merge 2 commits intoSponsorPay:masterfrom
Open
Fix long VARCHAR and short STRING issues#4brunograsselli wants to merge 2 commits intoSponsorPay:masterfrom
brunograsselli wants to merge 2 commits intoSponsorPay:masterfrom
Conversation
This reverts commit 51033ae.
The first issue happened with long VARCHAR fields. If the VARCHAR had more than 255 characters MYSQL uses 2 (not only 1) bytes to store some information at the beginning of the string. The previous code was aware of it but it checked it using the size of the string, not the information from the metadata of the field. In some cases it didn't work. After changing that I've introduced a new bug. There is a STRING type which the metadata is not the size of the field. You have to check inside this integer to find the size of the field. I fixed now how to get the size of the STRING field.
|
+1, this fixed a bug I was running into where varchar(255) columns with 256 characters were getting the first character inadvertently chopped off. |
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
The first issue happened with long VARCHAR fields. If the VARCHAR had
more than 255 characters MYSQL uses 2 (not only 1) bytes to store some
information at the beginning of the string.
The previous code was aware of it but it checked it using the size of
the string, not the information from the metadata of the field. In some
cases it didn't work.
After changing that I've introduced a new bug. There is a STRING type which
the metadata is not the size of the field. You have to check inside this
integer to find the size of the field.
I fixed now how to get the size of the STRING field.