File tree Expand file tree Collapse file tree 5 files changed +24
-0
lines changed Expand file tree Collapse file tree 5 files changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -12,3 +12,4 @@ Cargo.lock
1212
1313# IDEs
1414.idea
15+ .vscode
Original file line number Diff line number Diff line change @@ -730,6 +730,10 @@ pub enum Statement {
730730 ///
731731 /// Note: this is a PostgreSQL-specific statement.
732732 ShowVariable { variable : Vec < Ident > } ,
733+ /// SHOW VARIABLES
734+ ///
735+ /// Note: this is a MySQL-specific statement.
736+ ShowVariables { filter : Option < ShowStatementFilter > } ,
733737 /// SHOW CREATE TABLE
734738 ///
735739 /// Note: this is a MySQL-specific statement.
@@ -1295,6 +1299,13 @@ impl fmt::Display for Statement {
12951299 }
12961300 Ok ( ( ) )
12971301 }
1302+ Statement :: ShowVariables { filter } => {
1303+ write ! ( f, "SHOW VARIABLES" ) ?;
1304+ if filter. is_some ( ) {
1305+ write ! ( f, " {}" , filter. as_ref( ) . unwrap( ) . to_string( ) ) ?;
1306+ }
1307+ Ok ( ( ) )
1308+ }
12981309 Statement :: ShowCreate { obj_type, obj_name } => {
12991310 write ! (
13001311 f,
Original file line number Diff line number Diff line change @@ -477,6 +477,7 @@ define_keywords!(
477477 VALUE_OF ,
478478 VARBINARY ,
479479 VARCHAR ,
480+ VARIABLES ,
480481 VARYING ,
481482 VAR_POP ,
482483 VAR_SAMP ,
Original file line number Diff line number Diff line change @@ -2616,6 +2616,10 @@ impl<'a> Parser<'a> {
26162616 Ok ( self . parse_show_columns ( ) ?)
26172617 } else if self . parse_one_of_keywords ( & [ Keyword :: CREATE ] ) . is_some ( ) {
26182618 Ok ( self . parse_show_create ( ) ?)
2619+ } else if self . parse_one_of_keywords ( & [ Keyword :: VARIABLES ] ) . is_some ( ) {
2620+ Ok ( Statement :: ShowVariables {
2621+ filter : self . parse_show_statement_filter ( ) ?,
2622+ } )
26192623 } else {
26202624 Ok ( Statement :: ShowVariable {
26212625 variable : self . parse_identifiers ( ) ?,
Original file line number Diff line number Diff line change @@ -216,6 +216,13 @@ fn parse_create_table_with_minimum_display_width() {
216216 }
217217}
218218
219+ #[ test]
220+ fn parse_show_variables ( ) {
221+ mysql ( ) . verified_stmt ( "SHOW VARIABLES" ) ;
222+ mysql ( ) . verified_stmt ( "SHOW VARIABLES LIKE 'admin%'" ) ;
223+ mysql ( ) . verified_stmt ( "SHOW VARIABLES WHERE value = '3306'" ) ;
224+ }
225+
219226#[ test]
220227fn parse_set_names ( ) {
221228 let stmt = mysql_and_generic ( ) . verified_stmt ( "SET NAMES utf8mb4" ) ;
You can’t perform that action at this time.
0 commit comments