File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -991,6 +991,10 @@ pub enum Statement {
991991 ///
992992 /// Note: this is a PostgreSQL-specific statement.
993993 ShowVariable { variable : Vec < Ident > } ,
994+ /// SHOW VARIABLES
995+ ///
996+ /// Note: this is a MySQL-specific statement.
997+ ShowVariables { filter : Option < ShowStatementFilter > } ,
994998 /// SHOW CREATE TABLE
995999 ///
9961000 /// Note: this is a MySQL-specific statement.
@@ -1739,6 +1743,13 @@ impl fmt::Display for Statement {
17391743 }
17401744 Ok ( ( ) )
17411745 }
1746+ Statement :: ShowVariables { filter } => {
1747+ write ! ( f, "SHOW VARIABLES" ) ?;
1748+ if filter. is_some ( ) {
1749+ write ! ( f, " {}" , filter. as_ref( ) . unwrap( ) . to_string( ) ) ?;
1750+ }
1751+ Ok ( ( ) )
1752+ }
17421753 Statement :: ShowCreate { obj_type, obj_name } => {
17431754 write ! (
17441755 f,
Original file line number Diff line number Diff line change @@ -536,6 +536,7 @@ define_keywords!(
536536 VALUE_OF ,
537537 VARBINARY ,
538538 VARCHAR ,
539+ VARIABLES ,
539540 VARYING ,
540541 VAR_POP ,
541542 VAR_SAMP ,
Original file line number Diff line number Diff line change @@ -3542,6 +3542,10 @@ impl<'a> Parser<'a> {
35423542 Ok ( self . parse_show_columns ( ) ?)
35433543 } else if self . parse_one_of_keywords ( & [ Keyword :: CREATE ] ) . is_some ( ) {
35443544 Ok ( self . parse_show_create ( ) ?)
3545+ } else if self . parse_one_of_keywords ( & [ Keyword :: VARIABLES ] ) . is_some ( ) {
3546+ Ok ( Statement :: ShowVariables {
3547+ filter : self . parse_show_statement_filter ( ) ?,
3548+ } )
35453549 } else {
35463550 Ok ( Statement :: ShowVariable {
35473551 variable : self . parse_identifiers ( ) ?,
Original file line number Diff line number Diff line change @@ -800,6 +800,13 @@ fn parse_kill() {
800800 ) ;
801801}
802802
803+ #[ test]
804+ fn parse_show_variables ( ) {
805+ mysql ( ) . verified_stmt ( "SHOW VARIABLES" ) ;
806+ mysql ( ) . verified_stmt ( "SHOW VARIABLES LIKE 'admin%'" ) ;
807+ mysql ( ) . verified_stmt ( "SHOW VARIABLES WHERE value = '3306'" ) ;
808+ }
809+
803810fn mysql ( ) -> TestedDialects {
804811 TestedDialects {
805812 dialects : vec ! [ Box :: new( MySqlDialect { } ) ] ,
You can’t perform that action at this time.
0 commit comments