-
Notifications
You must be signed in to change notification settings - Fork 5.9k
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
server: fix ComStmtSendLongData when data length is 0 #7485
Conversation
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.
LGTM
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.
LGTM
/run-all-tests |
This is a way to solve the problem, but may not the best. We can make it work like this in
|
/run-all-tests |
PTAL @coocood |
LGTM |
(cherry picked from commit 09fb68a)
What problem does this PR solve?
setCharacterStream(1, new StringReader(""), 0);
this API in JDBC will useComStmtSendLongData
to send a long string. When the data length is 0, TiDB cannot distinguish whether there is a parameter with no data or there is no parameter at all.What is changed and how it works?
This pr appends an extra 0 at the end of the bound parameter. In ComStmtExecute, we use it to distinguish if there is a parameter or not.
(How does MySQL deal with this?
MySQL set the length of the parameter as len(data - 6), which 6 is the length of the header of the request.)
Check List
Tests
Code changes
Side effects
Related changes
PTAL @coocood