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

util, types: don't let SPM be affected by charset #23161

Merged
merged 26 commits into from
Mar 12, 2021
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
cd75598
util, types: restore without charset
rebelice Mar 8, 2021
d015fb7
Merge branch 'master' into dev_remove_charset
rebelice Mar 8, 2021
f385c86
Merge branch 'master' into dev_remove_charset
rebelice Mar 11, 2021
265cf71
Merge branch 'master' into dev_remove_charset
rebelice Mar 12, 2021
6c20a7c
Merge branch 'master' into dev_remove_charset
rebelice Mar 12, 2021
67c1a77
change parser commit
rebelice Mar 12, 2021
245251d
add test
rebelice Mar 12, 2021
1362b1a
make check
rebelice Mar 12, 2021
996e9dd
fix upgrade
rebelice Mar 12, 2021
6332de3
Merge branch 'master' into dev_remove_charset
rebelice Mar 12, 2021
63c7a89
fix test
rebelice Mar 12, 2021
4198879
Merge branch 'master' into dev_remove_charset
rebelice Mar 12, 2021
fda41e4
address comment
rebelice Mar 12, 2021
0a3bab2
address comment
rebelice Mar 12, 2021
2b77096
Merge branch 'master' into dev_remove_charset
ti-chi-bot Mar 12, 2021
ac5b324
fix tests
rebelice Mar 12, 2021
a426ef6
Merge branch 'master' into dev_remove_charset
rebelice Mar 12, 2021
5bcb48f
merge master
rebelice Mar 12, 2021
e16164b
fix build
rebelice Mar 12, 2021
f1df894
make check
rebelice Mar 12, 2021
ae77d4d
fix test
rebelice Mar 12, 2021
47b9bd7
Merge branch 'master' into dev_remove_charset
rebelice Mar 12, 2021
028ade4
Merge branch 'master' into dev_remove_charset
rebelice Mar 12, 2021
c138a05
Merge branch 'master' into dev_remove_charset
rebelice Mar 12, 2021
cb90df6
address comments
rebelice Mar 12, 2021
fcb136f
address comments
rebelice Mar 12, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions types/parser_driver/value_expr.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ func (n *ValueExpr) Restore(ctx *format.RestoreCtx) error {
// This part is used to process flag HasStringWithoutDefaultCharset, which means if we have this flag and the
// charset is mysql.DefaultCharset, we don't need to write the default.
if n.Type.Charset != "" &&
!ctx.Flags.HasStringWithoutCharset() &&
(!ctx.Flags.HasStringWithoutDefaultCharset() || n.Type.Charset != mysql.DefaultCharset) {
ctx.WritePlain("_")
ctx.WriteKeyWord(n.Type.Charset)
Expand Down
4 changes: 2 additions & 2 deletions util/parser/ast.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ func RestoreWithDefaultDB(node ast.StmtNode, defaultDB string) string {
// Three flags for restore with default DB:
// 1. RestoreStringSingleQuotes specifies to use single quotes to surround the string;
// 2. RestoreSpacesAroundBinaryOperation specifies to add space around binary operation;
// 3. RestoreStringWithoutDefaultCharset specifies to not print default charset before string;
ctx := format.NewRestoreCtx(format.RestoreStringSingleQuotes|format.RestoreSpacesAroundBinaryOperation|format.RestoreStringWithoutDefaultCharset, &sb)
// 3. RestoreStringWithoutCharset specifies to not print charset before string;
ctx := format.NewRestoreCtx(format.RestoreStringSingleQuotes|format.RestoreSpacesAroundBinaryOperation|format.RestoreStringWithoutCharset, &sb)
eurekaka marked this conversation as resolved.
Show resolved Hide resolved
ctx.DefaultDB = defaultDB
if err := node.Restore(ctx); err != nil {
return ""
Expand Down