File tree Expand file tree Collapse file tree 4 files changed +23
-0
lines changed Expand file tree Collapse file tree 4 files changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -996,6 +996,10 @@ pub enum Statement {
996996 ///
997997 /// Note: this is a PostgreSQL-specific statement.
998998 ShowVariable { variable : Vec < Ident > } ,
999+ /// SHOW VARIABLES
1000+ ///
1001+ /// Note: this is a MySQL-specific statement.
1002+ ShowVariables { filter : Option < ShowStatementFilter > } ,
9991003 /// SHOW CREATE TABLE
10001004 ///
10011005 /// Note: this is a MySQL-specific statement.
@@ -1787,6 +1791,13 @@ impl fmt::Display for Statement {
17871791 }
17881792 Ok ( ( ) )
17891793 }
1794+ Statement :: ShowVariables { filter } => {
1795+ write ! ( f, "SHOW VARIABLES" ) ?;
1796+ if filter. is_some ( ) {
1797+ write ! ( f, " {}" , filter. as_ref( ) . unwrap( ) . to_string( ) ) ?;
1798+ }
1799+ Ok ( ( ) )
1800+ }
17901801 Statement :: ShowCreate { obj_type, obj_name } => {
17911802 write ! (
17921803 f,
Original file line number Diff line number Diff line change @@ -543,6 +543,7 @@ define_keywords!(
543543 VALUE_OF ,
544544 VARBINARY ,
545545 VARCHAR ,
546+ VARIABLES ,
546547 VARYING ,
547548 VAR_POP ,
548549 VAR_SAMP ,
Original file line number Diff line number Diff line change @@ -3694,6 +3694,10 @@ impl<'a> Parser<'a> {
36943694 Ok ( self . parse_show_columns ( ) ?)
36953695 } else if self . parse_one_of_keywords ( & [ Keyword :: CREATE ] ) . is_some ( ) {
36963696 Ok ( self . parse_show_create ( ) ?)
3697+ } else if self . parse_keyword ( Keyword :: VARIABLES ) && dialect_of ! ( self is MySqlDialect | GenericDialect ) {
3698+ Ok ( Statement :: ShowVariables {
3699+ filter : self . parse_show_statement_filter ( ) ?,
3700+ } )
36973701 } else {
36983702 Ok ( Statement :: ShowVariable {
36993703 variable : self . parse_identifiers ( ) ?,
Original file line number Diff line number Diff line change @@ -820,6 +820,13 @@ fn parse_substring_in_select() {
820820 }
821821}
822822
823+ #[ test]
824+ fn parse_show_variables ( ) {
825+ mysql_and_generic ( ) . verified_stmt ( "SHOW VARIABLES" ) ;
826+ mysql_and_generic ( ) . verified_stmt ( "SHOW VARIABLES LIKE 'admin%'" ) ;
827+ mysql_and_generic ( ) . verified_stmt ( "SHOW VARIABLES WHERE value = '3306'" ) ;
828+ }
829+
823830#[ test]
824831fn parse_kill ( ) {
825832 let stmt = mysql_and_generic ( ) . verified_stmt ( "KILL CONNECTION 5" ) ;
You can’t perform that action at this time.
0 commit comments