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 @@ -859,6 +859,10 @@ pub enum Statement {
859859 ///
860860 /// Note: this is a PostgreSQL-specific statement.
861861 ShowVariable { variable : Vec < Ident > } ,
862+ /// SHOW VARIABLES
863+ ///
864+ /// Note: this is a MySQL-specific statement.
865+ ShowVariables { filter : Option < ShowStatementFilter > } ,
862866 /// SHOW CREATE TABLE
863867 ///
864868 /// Note: this is a MySQL-specific statement.
@@ -1484,6 +1488,13 @@ impl fmt::Display for Statement {
14841488 }
14851489 Ok ( ( ) )
14861490 }
1491+ Statement :: ShowVariables { filter } => {
1492+ write ! ( f, "SHOW VARIABLES" ) ?;
1493+ if filter. is_some ( ) {
1494+ write ! ( f, " {}" , filter. as_ref( ) . unwrap( ) . to_string( ) ) ?;
1495+ }
1496+ Ok ( ( ) )
1497+ }
14871498 Statement :: ShowCreate { obj_type, obj_name } => {
14881499 write ! (
14891500 f,
Original file line number Diff line number Diff line change @@ -511,6 +511,7 @@ define_keywords!(
511511 VALUE_OF ,
512512 VARBINARY ,
513513 VARCHAR ,
514+ VARIABLES ,
514515 VARYING ,
515516 VAR_POP ,
516517 VAR_SAMP ,
Original file line number Diff line number Diff line change @@ -3062,6 +3062,10 @@ impl<'a> Parser<'a> {
30623062 Ok ( self . parse_show_columns ( ) ?)
30633063 } else if self . parse_one_of_keywords ( & [ Keyword :: CREATE ] ) . is_some ( ) {
30643064 Ok ( self . parse_show_create ( ) ?)
3065+ } else if self . parse_one_of_keywords ( & [ Keyword :: VARIABLES ] ) . is_some ( ) {
3066+ Ok ( Statement :: ShowVariables {
3067+ filter : self . parse_show_statement_filter ( ) ?,
3068+ } )
30653069 } else {
30663070 Ok ( Statement :: ShowVariable {
30673071 variable : self . parse_identifiers ( ) ?,
Original file line number Diff line number Diff line change @@ -765,6 +765,13 @@ fn parse_substring_in_select() {
765765 }
766766}
767767
768+ #[ test]
769+ fn parse_show_variables ( ) {
770+ mysql ( ) . verified_stmt ( "SHOW VARIABLES" ) ;
771+ mysql ( ) . verified_stmt ( "SHOW VARIABLES LIKE 'admin%'" ) ;
772+ mysql ( ) . verified_stmt ( "SHOW VARIABLES WHERE value = '3306'" ) ;
773+ }
774+
768775#[ test]
769776fn parse_set_names ( ) {
770777 let stmt = mysql_and_generic ( ) . verified_stmt ( "SET NAMES utf8mb4" ) ;
You can’t perform that action at this time.
0 commit comments