Skip to content

Commit

Permalink
parser: Support show function status grammar (pingcap#1710)
Browse files Browse the repository at this point in the history
Parsed but do nothing. Just make workbench happy.
  • Loading branch information
shenli authored Sep 9, 2016
1 parent dde36a1 commit 099e8a9
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
1 change: 1 addition & 0 deletions parser/misc.go
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,7 @@ var tokenMap = map[string]int{
"FROM": from,
"FULL": full,
"FULLTEXT": fulltext,
"FUNCTION": function,
"FLUSH": flush,
"GET_LOCK": getLock,
"GLOBAL": global,
Expand Down
13 changes: 12 additions & 1 deletion parser/parser.y
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ import (
fixed "FIXED"
flush "FLUSH"
full "FULL"
function "FUNCTION"
grants "GRANTS"
hash "HASH"
identified "IDENTIFIED"
Expand Down Expand Up @@ -1967,7 +1968,7 @@ UnReservedKeyword:
| "COLLATION" | "COMMENT" | "AVG_ROW_LENGTH" | "CONNECTION" | "CHECKSUM" | "COMPRESSION" | "KEY_BLOCK_SIZE" | "MAX_ROWS"
| "MIN_ROWS" | "NATIONAL" | "ROW" | "ROW_FORMAT" | "QUARTER" | "GRANTS" | "TRIGGERS" | "DELAY_KEY_WRITE" | "ISOLATION"
| "REPEATABLE" | "COMMITTED" | "UNCOMMITTED" | "ONLY" | "SERIALIZABLE" | "LEVEL" | "VARIABLES" | "SQL_CACHE"
| "SQL_NO_CACHE" | "DISABLE" | "ENABLE" | "REVERSE" | "SPACE" | "PRIVILEGES" | "NO" | "BINLOG"
| "SQL_NO_CACHE" | "DISABLE" | "ENABLE" | "REVERSE" | "SPACE" | "PRIVILEGES" | "NO" | "BINLOG" | "FUNCTION"

NotKeywordToken:
"ABS" | "ADDDATE" | "ADMIN" | "COALESCE" | "CONCAT" | "CONCAT_WS" | "CONNECTION_ID" | "CUR_TIME"| "COUNT" | "DAY"
Expand Down Expand Up @@ -4062,6 +4063,16 @@ ShowTargetFilterable:
Tp: ast.ShowProcedureStatus,
}
}
| "FUNCTION" "STATUS"
{
// This statement is similar to SHOW PROCEDURE STATUS but for stored functions.
// See http://dev.mysql.com/doc/refman/5.7/en/show-function-status.html
// We do not support neither stored functions nor stored procedures.
// So we reuse show procedure status process logic.
$$ = &ast.ShowStmt {
Tp: ast.ShowProcedureStatus,
}
}

ShowLikeOrWhereOpt:
{
Expand Down
3 changes: 2 additions & 1 deletion parser/parser_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ func (s *testParserSuite) TestSimple(c *C) {
"curtime", "variables", "dayname", "version", "btree", "hash", "row_format", "dynamic", "fixed", "compressed",
"compact", "redundant", "sql_no_cache sql_no_cache", "sql_cache sql_cache", "action", "round",
"enable", "disable", "reverse", "space", "privileges", "get_lock", "release_lock", "sleep", "no", "greatest",
"binlog", "hex", "unhex",
"binlog", "hex", "unhex", "function",
}
for _, kw := range unreservedKws {
src := fmt.Sprintf("SELECT %s FROM tbl;", kw)
Expand Down Expand Up @@ -325,6 +325,7 @@ func (s *testParserSuite) TestDBAStmt(c *C) {
{`SHOW TRIGGERS LIKE 't'`, true},
{`SHOW DATABASES LIKE 'test2'`, true},
{`SHOW PROCEDURE STATUS WHERE Db='test'`, true},
{`SHOW FUNCTION STATUS WHERE Db='test'`, true},
{`SHOW INDEX FROM t;`, true},
{`SHOW KEYS FROM t;`, true},
// For show character set
Expand Down

0 comments on commit 099e8a9

Please sign in to comment.