Skip to content

Commit

Permalink
feat: support show create event, trigger and procedure in mysql
Browse files Browse the repository at this point in the history
  • Loading branch information
taozhi8833998 committed Nov 3, 2023
1 parent 3e944d1 commit 730c0d4
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pegjs/mariadb.pegjs
Original file line number Diff line number Diff line change
Expand Up @@ -1350,7 +1350,7 @@ show_stmt
}
};
}
/ KW_SHOW __ KW_CREATE __ k:(KW_VIEW / KW_TABLE) __ t:table_name {
/ KW_SHOW __ KW_CREATE __ k:(KW_VIEW / KW_TABLE / 'EVENT'i / KW_TRIGGER / 'PROCEDURE'i) __ t:table_name {
const suffix = k.toLowerCase()
return {
tableList: Array.from(tableList),
Expand Down
2 changes: 1 addition & 1 deletion pegjs/mysql.pegjs
Original file line number Diff line number Diff line change
Expand Up @@ -1656,7 +1656,7 @@ show_stmt
}
};
}
/ KW_SHOW __ KW_CREATE __ k:(KW_VIEW / KW_TABLE) __ t:table_name {
/ KW_SHOW __ KW_CREATE __ k:(KW_VIEW / KW_TABLE / 'EVENT'i / KW_TRIGGER / 'PROCEDURE'i) __ t:table_name {
const suffix = k.toLowerCase()
return {
tableList: Array.from(tableList),
Expand Down
14 changes: 14 additions & 0 deletions test/mysql-mariadb.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,20 @@ describe('mysql', () => {
'SHOW CREATE VIEW `abc`.`test`'
]
},
{
title: 'show create event',
sql: [
'SHOW CREATE EVENT `monthly_gc`',
'SHOW CREATE EVENT `monthly_gc`'
]
},
{
title: 'show create procedure',
sql: [
'SHOW CREATE PROCEDURE get_jails',
'SHOW CREATE PROCEDURE `get_jails`'
]
},
{
title: 'with',
sql: [
Expand Down

0 comments on commit 730c0d4

Please sign in to comment.