diff --git a/ast/misc.go b/ast/misc.go index c5415122da16a..be45df476cd2e 100644 --- a/ast/misc.go +++ b/ast/misc.go @@ -168,6 +168,7 @@ const ( ShowCreateTable ShowGrants ShowTriggers + ShowProcedureStatus ) // ShowStmt is a statement to provide information about databases, tables, columns and so on. diff --git a/executor/converter/convert_stmt.go b/executor/converter/convert_stmt.go index 68124161578af..00fbb353453e7 100644 --- a/executor/converter/convert_stmt.go +++ b/executor/converter/convert_stmt.go @@ -878,6 +878,8 @@ func convertShow(converter *expressionConverter, v *ast.ShowStmt) (*stmts.ShowSt oldShow.Target = stmt.ShowTableStatus case ast.ShowTriggers: oldShow.Target = stmt.ShowTriggers + case ast.ShowProcedureStatus: + oldShow.Target = stmt.ShowProcedureStatus case ast.ShowNone: oldShow.Target = stmt.ShowNone } diff --git a/parser/parser.y b/parser/parser.y index b5eabf6555518..d908fee1c1221 100644 --- a/parser/parser.y +++ b/parser/parser.y @@ -214,6 +214,7 @@ import ( placeholder "PLACEHOLDER" prepare "PREPARE" primary "PRIMARY" + procedure "PROCEDURE" quarter "QUARTER" quick "QUICK" rand "RAND" @@ -3456,6 +3457,12 @@ ShowTargetFilterable: DBName: $2.(string), } } +| "PROCEDURE" "STATUS" + { + $$ = &ast.ShowStmt { + Tp: ast.ShowProcedureStatus, + } + } ShowLikeOrWhereOpt: { diff --git a/parser/parser_test.go b/parser/parser_test.go index 7ccadaa78c7e4..b06336c29ca10 100644 --- a/parser/parser_test.go +++ b/parser/parser_test.go @@ -262,7 +262,8 @@ func (s *testParserSuite) TestDMLStmt(c *C) { {`SHOW COLUMNS FROM City;`, true}, {`SHOW FIELDS FROM City;`, true}, {`SHOW TRIGGERS LIKE 't'`, true}, - {"SHOW DATABASES LIKE 'test2'", true}, + {`SHOW DATABASES LIKE 'test2'`, true}, + {`SHOW PROCEDURE STATUS WHERE Db='test'`, true}, // For default value {"CREATE TABLE sbtest (id INTEGER UNSIGNED NOT NULL AUTO_INCREMENT, k integer UNSIGNED DEFAULT '0' NOT NULL, c char(120) DEFAULT '' NOT NULL, pad char(60) DEFAULT '' NOT NULL, PRIMARY KEY (id) )", true}, diff --git a/parser/scanner.l b/parser/scanner.l index 9fdfd1fc6c9df..9e125165dea75 100644 --- a/parser/scanner.l +++ b/parser/scanner.l @@ -418,6 +418,7 @@ outer {o}{u}{t}{e}{r} password {p}{a}{s}{s}{w}{o}{r}{d} prepare {p}{r}{e}{p}{a}{r}{e} primary {p}{r}{i}{m}{a}{r}{y} +procedure {p}{r}{o}{c}{e}{d}{u}{r}{e} quarter {q}{u}{a}{r}{t}{e}{r} quick {q}{u}{i}{c}{k} rand {r}{a}{n}{d} @@ -859,6 +860,7 @@ year_month {y}{e}{a}{r}_{m}{o}{n}{t}{h} {prepare} lval.item = string(l.val) return prepare {primary} return primary +{procedure} return procedure {quarter} lval.item = string(l.val) return quarter {quick} lval.item = string(l.val) diff --git a/plan/plans/show.go b/plan/plans/show.go index 72ebaa51992a7..79910fd5041b6 100644 --- a/plan/plans/show.go +++ b/plan/plans/show.go @@ -128,6 +128,9 @@ func (s *ShowPlan) GetFields() []*field.ResultField { "sql_mode", "Definer", "character_set_client", "collation_connection", "Database Collation"} types = []byte{mysql.TypeVarchar, mysql.TypeVarchar, mysql.TypeVarchar, mysql.TypeVarchar, mysql.TypeVarchar, mysql.TypeVarchar, mysql.TypeVarchar, mysql.TypeVarchar, mysql.TypeVarchar, mysql.TypeVarchar, mysql.TypeVarchar} + case stmt.ShowProcedureStatus: + names = []string{} + types = []byte{} } fields := make([]*field.ResultField, 0, len(names)) for i, name := range names { @@ -193,6 +196,8 @@ func (s *ShowPlan) fetchAll(ctx context.Context) error { return s.fetchShowGrants(ctx) case stmt.ShowTriggers: return s.fetchShowTriggers(ctx) + case stmt.ShowProcedureStatus: + return s.fetchShowProcedureStatus(ctx) } return nil } @@ -660,3 +665,8 @@ func (s *ShowPlan) fetchShowGrants(ctx context.Context) error { func (s *ShowPlan) fetchShowTriggers(ctx context.Context) error { return nil } + +// Do nothing. +func (s *ShowPlan) fetchShowProcedureStatus(ctx context.Context) error { + return nil +} diff --git a/stmt/stmt.go b/stmt/stmt.go index e0ab1d5e05ef3..d051b405cce07 100644 --- a/stmt/stmt.go +++ b/stmt/stmt.go @@ -61,6 +61,7 @@ const ( ShowCreateTable ShowGrants ShowTriggers + ShowProcedureStatus ) const (