Skip to content

Commit

Permalink
Merge pull request #4067 from dweitzman/sqlalchemy_collation
Browse files Browse the repository at this point in the history
Parsing support for SHOW COLLATION WHERE
  • Loading branch information
sougou authored Jul 9, 2018
2 parents 00f4b8d + 58bf0a6 commit 69a63c4
Show file tree
Hide file tree
Showing 5 changed files with 1,508 additions and 1,464 deletions.
12 changes: 8 additions & 4 deletions go/vt/sqlparser/ast.go
Original file line number Diff line number Diff line change
Expand Up @@ -1280,10 +1280,11 @@ func (node VindexParam) walkSubtree(visit Visit) error {

// Show represents a show statement.
type Show struct {
Type string
OnTable TableName
ShowTablesOpt *ShowTablesOpt
Scope string
Type string
OnTable TableName
ShowTablesOpt *ShowTablesOpt
Scope string
ShowCollationFilterOpt *Expr
}

// Format formats the node.
Expand All @@ -1308,6 +1309,9 @@ func (node *Show) Format(buf *TrackedBuffer) {
if node.HasOnTable() {
buf.Myprintf(" on %v", node.OnTable)
}
if node.Type == "collation" && node.ShowCollationFilterOpt != nil {
buf.Myprintf(" where %v", *node.ShowCollationFilterOpt)
}
}

// HasOnTable returns true if the show statement has an "on" clause
Expand Down
3 changes: 3 additions & 0 deletions go/vt/sqlparser/parse_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -993,6 +993,9 @@ var (
}, {
input: "show collation",
output: "show collation",
}, {
input: "show collation where `Charset` = 'utf8' and `Collation` = 'utf8_bin'",
output: "show collation where `Charset` = 'utf8' and `Collation` = 'utf8_bin'",
}, {
input: "show create database d",
output: "show create database",
Expand Down
Loading

0 comments on commit 69a63c4

Please sign in to comment.