Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/pingcap/parser into admin…
Browse files Browse the repository at this point in the history
…-show-where
  • Loading branch information
crazycs520 committed Oct 11, 2019
2 parents 85344bd + 51a2e3b commit 098d4f9
Show file tree
Hide file tree
Showing 8 changed files with 7,327 additions and 7,260 deletions.
4 changes: 4 additions & 0 deletions ast/ddl.go
Original file line number Diff line number Diff line change
Expand Up @@ -428,6 +428,7 @@ const (
ColumnOptionCollate
ColumnOptionCheck
ColumnOptionColumnFormat
ColumnOptionStorage
)

var (
Expand Down Expand Up @@ -525,6 +526,9 @@ func (n *ColumnOption) Restore(ctx *RestoreCtx) error {
case ColumnOptionColumnFormat:
ctx.WriteKeyWord("COLUMN_FORMAT ")
ctx.WriteKeyWord(n.StrValue)
case ColumnOptionStorage:
ctx.WriteKeyWord("STORAGE ")
ctx.WriteKeyWord(n.StrValue)
default:
return errors.New("An error occurred while splicing ColumnOption")
}
Expand Down
3 changes: 3 additions & 0 deletions ast/ddl_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,9 @@ func (ts *testDDLSuite) TestDDLColumnOptionRestore(c *C) {
{"generated always as(id + 1) stored", "GENERATED ALWAYS AS(`id`+1) STORED"},
{"REFERENCES parent(id)", "REFERENCES `parent`(`id`)"},
{"COLLATE utf8_bin", "COLLATE utf8_bin"},
{"STORAGE DEFAULT", "STORAGE DEFAULT"},
{"STORAGE DISK", "STORAGE DISK"},
{"STORAGE MEMORY", "STORAGE MEMORY"},
}
extractNodeFunc := func(node Node) Node {
return node.(*CreateTableStmt).Cols[0].Options[0]
Expand Down
3 changes: 3 additions & 0 deletions ast/dml.go
Original file line number Diff line number Diff line change
Expand Up @@ -1828,6 +1828,7 @@ const (
ShowOpenTables
ShowAnalyzeStatus
ShowRegions
ShowBuiltins
)

const (
Expand Down Expand Up @@ -2018,6 +2019,8 @@ func (n *ShowStmt) Restore(ctx *RestoreCtx) error {

case ShowPrivileges:
ctx.WriteKeyWord("PRIVILEGES")
case ShowBuiltins:
ctx.WriteKeyWord("BUILTINS")
// ShowTargetFilterable
default:
switch n.Tp {
Expand Down
1 change: 1 addition & 0 deletions ast/misc.go
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,7 @@ type ExecuteStmt struct {
UsingVars []ExprNode
BinaryArgs interface{}
ExecID uint32
IdxInMulti int
}

// Restore implements Node interface.
Expand Down
1 change: 1 addition & 0 deletions misc.go
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@ var tokenMap = map[string]int{
"BOTH": both,
"BTREE": btree,
"BUCKETS": buckets,
"BUILTINS": builtins,
"BY": by,
"BYTE": byteType,
"CANCEL": cancel,
Expand Down
Loading

0 comments on commit 098d4f9

Please sign in to comment.