Skip to content
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

bindinfo: correctly handle quotes for bindings sql #13115

Merged
merged 2 commits into from Nov 4, 2019

Conversation

alivxxx
Copy link
Contributor

@alivxxx alivxxx commented Nov 4, 2019

What problem does this PR solve?

mysql> create global binding for select * from t where a = '1' using select * from t use index(idx) where a = '1';
[2019/11/04 14:59:18.561 +08:00] [WARN] [session.go:1078] ["parse SQL failed"] [error="line 1 column 111 near \"1'', 'test', 'using', '2019-11-04 14:58:22.461', '2019-11-04 14:58:22.461','utf8mb4', 'utf8mb4_unicode_ci')\" "] [SQL="INSERT INTO mysql.bind_info VALUES ('select * from t where a = ?', 'select * from t use index(idx) where a = '1'', 'test', 'using', '2019-11-04 14:58:22.461', '2019-11-04 14:58:22.461','utf8mb4', 'utf8mb4_unicode_ci')"]

What is changed and how it works?

The quote is not correctly handled, the result sql cannot be parsed by tidb. This PR reuses the quote function logic to handle this case.

Check List

Tests

  • Unit test

Code changes

  • Has exported function/method change

Side effects

  • None

Related changes

  • None

Release note

  • correctly handle quotes for bindings sql

@alivxxx alivxxx requested a review from a team as a code owner November 4, 2019 07:06
@ghost ghost requested review from SunRunAway and wshwsh12 and removed request for a team November 4, 2019 07:07
@codecov
Copy link

codecov bot commented Nov 4, 2019

Codecov Report

Merging #13115 into master will not change coverage.
The diff coverage is n/a.

@@           Coverage Diff           @@
##           master   #13115   +/-   ##
=======================================
  Coverage    80.1%    80.1%           
=======================================
  Files         468      468           
  Lines      110523   110523           
=======================================
  Hits        88529    88529           
  Misses      15205    15205           
  Partials     6789     6789

Copy link
Member

@winoros winoros left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@winoros winoros added the status/LGT1 Indicates that a PR has LGTM 1. label Nov 4, 2019
Copy link
Member

@lzmhhh123 lzmhhh123 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@lzmhhh123 lzmhhh123 added status/can-merge Indicates a PR has been approved by a committer. status/LGT2 Indicates that a PR has LGTM 2. and removed status/LGT1 Indicates that a PR has LGTM 1. labels Nov 4, 2019
@sre-bot
Copy link
Contributor

sre-bot commented Nov 4, 2019

/run-all-tests

@sre-bot sre-bot merged commit 3a1fb29 into pingcap:master Nov 4, 2019
@sre-bot
Copy link
Contributor

sre-bot commented Nov 4, 2019

cherry pick to release-3.1 failed

@alivxxx alivxxx deleted the binding-quote branch November 4, 2019 07:58
@sre-bot
Copy link
Contributor

sre-bot commented Nov 4, 2019

cherry pick to release-3.0 failed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status/can-merge Indicates a PR has been approved by a committer. status/LGT2 Indicates that a PR has LGTM 2. type/bug-fix This PR fixes a bug.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants