Skip to content

Commit

Permalink
Merge pull request #1647 from taozhi8833998/feat-show-create-mysql
Browse files Browse the repository at this point in the history
feat: support show create event, trigger and procedure in mysql
  • Loading branch information
taozhi8833998 authored Nov 4, 2023
2 parents 248d893 + 730c0d4 commit de6a445
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 de6a445

Please sign in to comment.