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 {
1739
1739
/// SHOW VARIABLES
1740
1740
///
1741
1741
/// 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
+ } ,
1743
1747
/// SHOW CREATE TABLE
1744
1748
///
1745
1749
/// Note: this is a MySQL-specific statement.
@@ -2977,8 +2981,19 @@ impl fmt::Display for Statement {
2977
2981
}
2978
2982
Ok ( ( ) )
2979
2983
}
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" ) ?;
2982
2997
if filter. is_some ( ) {
2983
2998
write ! ( f, " {}" , filter. as_ref( ) . unwrap( ) ) ?;
2984
2999
}
Original file line number Diff line number Diff line change @@ -6443,6 +6443,8 @@ impl<'a> Parser<'a> {
6443
6443
pub fn parse_show ( & mut self ) -> Result < Statement , ParserError > {
6444
6444
let extended = self . parse_keyword ( Keyword :: EXTENDED ) ;
6445
6445
let full = self . parse_keyword ( Keyword :: FULL ) ;
6446
+ let session = self . parse_keyword ( Keyword :: SESSION ) ;
6447
+ let global = self . parse_keyword ( Keyword :: GLOBAL ) ;
6446
6448
if self
6447
6449
. parse_one_of_keywords ( & [ Keyword :: COLUMNS , Keyword :: FIELDS ] )
6448
6450
. is_some ( )
@@ -6463,9 +6465,10 @@ impl<'a> Parser<'a> {
6463
6465
} else if self . parse_keyword ( Keyword :: VARIABLES )
6464
6466
&& dialect_of ! ( self is MySqlDialect | GenericDialect )
6465
6467
{
6466
- // TODO: Support GLOBAL|SESSION
6467
6468
Ok ( Statement :: ShowVariables {
6468
6469
filter : self . parse_show_statement_filter ( ) ?,
6470
+ session,
6471
+ global,
6469
6472
} )
6470
6473
} else {
6471
6474
Ok ( Statement :: ShowVariable {
Original file line number Diff line number Diff line change @@ -1512,6 +1512,12 @@ fn parse_show_variables() {
1512
1512
mysql_and_generic ( ) . verified_stmt ( "SHOW VARIABLES" ) ;
1513
1513
mysql_and_generic ( ) . verified_stmt ( "SHOW VARIABLES LIKE 'admin%'" ) ;
1514
1514
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'" ) ;
1515
1521
}
1516
1522
1517
1523
#[ test]
You can’t perform that action at this time.
0 commit comments