File tree Expand file tree Collapse file tree 3 files changed +28
-4
lines changed
Expand file tree Collapse file tree 3 files changed +28
-4
lines changed Original file line number Diff line number Diff line change @@ -1739,7 +1739,11 @@ pub enum Statement {
17391739 /// SHOW VARIABLES
17401740 ///
17411741 /// Note: this is a MySQL-specific statement.
1742- ShowVariables { filter : Option < ShowStatementFilter > } ,
1742+ ShowVariables {
1743+ filter : Option < ShowStatementFilter > ,
1744+ global : bool ,
1745+ session : bool ,
1746+ } ,
17431747 /// SHOW CREATE TABLE
17441748 ///
17451749 /// Note: this is a MySQL-specific statement.
@@ -2977,8 +2981,19 @@ impl fmt::Display for Statement {
29772981 }
29782982 Ok ( ( ) )
29792983 }
2980- Statement :: ShowVariables { filter } => {
2981- write ! ( f, "SHOW VARIABLES" ) ?;
2984+ Statement :: ShowVariables {
2985+ filter,
2986+ global,
2987+ session,
2988+ } => {
2989+ write ! ( f, "SHOW" ) ?;
2990+ if * global {
2991+ write ! ( f, " GLOBAL" ) ?;
2992+ }
2993+ if * session {
2994+ write ! ( f, " SESSION" ) ?;
2995+ }
2996+ write ! ( f, " VARIABLES" ) ?;
29822997 if filter. is_some ( ) {
29832998 write ! ( f, " {}" , filter. as_ref( ) . unwrap( ) ) ?;
29842999 }
Original file line number Diff line number Diff line change @@ -6443,6 +6443,8 @@ impl<'a> Parser<'a> {
64436443 pub fn parse_show ( & mut self ) -> Result < Statement , ParserError > {
64446444 let extended = self . parse_keyword ( Keyword :: EXTENDED ) ;
64456445 let full = self . parse_keyword ( Keyword :: FULL ) ;
6446+ let session = self . parse_keyword ( Keyword :: SESSION ) ;
6447+ let global = self . parse_keyword ( Keyword :: GLOBAL ) ;
64466448 if self
64476449 . parse_one_of_keywords ( & [ Keyword :: COLUMNS , Keyword :: FIELDS ] )
64486450 . is_some ( )
@@ -6463,9 +6465,10 @@ impl<'a> Parser<'a> {
64636465 } else if self . parse_keyword ( Keyword :: VARIABLES )
64646466 && dialect_of ! ( self is MySqlDialect | GenericDialect )
64656467 {
6466- // TODO: Support GLOBAL|SESSION
64676468 Ok ( Statement :: ShowVariables {
64686469 filter : self . parse_show_statement_filter ( ) ?,
6470+ session,
6471+ global,
64696472 } )
64706473 } else {
64716474 Ok ( Statement :: ShowVariable {
Original file line number Diff line number Diff line change @@ -1512,6 +1512,12 @@ fn parse_show_variables() {
15121512 mysql_and_generic ( ) . verified_stmt ( "SHOW VARIABLES" ) ;
15131513 mysql_and_generic ( ) . verified_stmt ( "SHOW VARIABLES LIKE 'admin%'" ) ;
15141514 mysql_and_generic ( ) . verified_stmt ( "SHOW VARIABLES WHERE value = '3306'" ) ;
1515+ mysql_and_generic ( ) . verified_stmt ( "SHOW GLOBAL VARIABLES" ) ;
1516+ mysql_and_generic ( ) . verified_stmt ( "SHOW GLOBAL VARIABLES LIKE 'admin%'" ) ;
1517+ mysql_and_generic ( ) . verified_stmt ( "SHOW GLOBAL VARIABLES WHERE value = '3306'" ) ;
1518+ mysql_and_generic ( ) . verified_stmt ( "SHOW SESSION VARIABLES" ) ;
1519+ mysql_and_generic ( ) . verified_stmt ( "SHOW SESSION VARIABLES LIKE 'admin%'" ) ;
1520+ mysql_and_generic ( ) . verified_stmt ( "SHOW GLOBAL VARIABLES WHERE value = '3306'" ) ;
15151521}
15161522
15171523#[ test]
You can’t perform that action at this time.
0 commit comments