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 @@ -863,6 +863,10 @@ pub enum Statement {
863
863
///
864
864
/// Note: this is a PostgreSQL-specific statement.
865
865
ShowVariable { variable : Vec < Ident > } ,
866
+ /// SHOW VARIABLES
867
+ ///
868
+ /// Note: this is a MySQL-specific statement.
869
+ ShowVariables { filter : Option < ShowStatementFilter > } ,
866
870
/// SHOW CREATE TABLE
867
871
///
868
872
/// Note: this is a MySQL-specific statement.
@@ -1500,6 +1504,13 @@ impl fmt::Display for Statement {
1500
1504
}
1501
1505
Ok ( ( ) )
1502
1506
}
1507
+ Statement :: ShowVariables { filter } => {
1508
+ write ! ( f, "SHOW VARIABLES" ) ?;
1509
+ if filter. is_some ( ) {
1510
+ write ! ( f, " {}" , filter. as_ref( ) . unwrap( ) . to_string( ) ) ?;
1511
+ }
1512
+ Ok ( ( ) )
1513
+ }
1503
1514
Statement :: ShowCreate { obj_type, obj_name } => {
1504
1515
write ! (
1505
1516
f,
Original file line number Diff line number Diff line change @@ -522,6 +522,7 @@ define_keywords!(
522
522
VALUE_OF ,
523
523
VARBINARY ,
524
524
VARCHAR ,
525
+ VARIABLES ,
525
526
VARYING ,
526
527
VAR_POP ,
527
528
VAR_SAMP ,
Original file line number Diff line number Diff line change @@ -3204,6 +3204,10 @@ impl<'a> Parser<'a> {
3204
3204
Ok ( self . parse_show_columns ( ) ?)
3205
3205
} else if self . parse_one_of_keywords ( & [ Keyword :: CREATE ] ) . is_some ( ) {
3206
3206
Ok ( self . parse_show_create ( ) ?)
3207
+ } else if self . parse_one_of_keywords ( & [ Keyword :: VARIABLES ] ) . is_some ( ) {
3208
+ Ok ( Statement :: ShowVariables {
3209
+ filter : self . parse_show_statement_filter ( ) ?,
3210
+ } )
3207
3211
} else {
3208
3212
Ok ( Statement :: ShowVariable {
3209
3213
variable : self . parse_identifiers ( ) ?,
Original file line number Diff line number Diff line change @@ -768,6 +768,13 @@ fn parse_substring_in_select() {
768
768
}
769
769
}
770
770
771
+ #[ test]
772
+ fn parse_show_variables ( ) {
773
+ mysql ( ) . verified_stmt ( "SHOW VARIABLES" ) ;
774
+ mysql ( ) . verified_stmt ( "SHOW VARIABLES LIKE 'admin%'" ) ;
775
+ mysql ( ) . verified_stmt ( "SHOW VARIABLES WHERE value = '3306'" ) ;
776
+ }
777
+
771
778
#[ test]
772
779
fn parse_set_names ( ) {
773
780
let stmt = mysql_and_generic ( ) . verified_stmt ( "SET NAMES utf8mb4" ) ;
You can’t perform that action at this time.
0 commit comments