Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support MySQL system variables (#3576)
* Modify at_sign lexer and add parser to handle MyQL system variables + provide fixtures for validation. * Improve at_sign lexer. $ sign is now supported, and a `.` cannot be at the start/end of a variable name. Co-authored-by: Barry Hart <barrywhart@yahoo.com>
- Loading branch information
1 parent
50f0638
commit faa1c83
Showing
5 changed files
with
105 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,4 @@ | ||
set @abc = 1; | ||
set @abc = 1; | ||
set @my_var = 1; | ||
set @my$currency = 1; | ||
set @sha256enabled = 1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
SELECT @@global.time_zone; | ||
SELECT @@session.time_zone; | ||
SELECT @@global.version; | ||
SELECT @@session.rand_seed1; | ||
SELECT CONVERT_TZ(NOW(), @@global.time_zone, '+00:00') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
# YML test files are auto-generated from SQL files and should not be edited by | ||
# hand. To help enforce this, the "hash" field in the file must match a hash | ||
# computed by SQLFluff when running the tests. Please run | ||
# `python test/generate_parse_fixture_yml.py` to generate them after adding or | ||
# altering SQL files. | ||
_hash: 7ee845cc79c4b19c5a15b765bf58282520be92649f543a90c3badb1900de89e4 | ||
file: | ||
- statement: | ||
select_statement: | ||
select_clause: | ||
keyword: SELECT | ||
select_clause_element: | ||
system_variable: '@@global.time_zone' | ||
- statement_terminator: ; | ||
- statement: | ||
select_statement: | ||
select_clause: | ||
keyword: SELECT | ||
select_clause_element: | ||
system_variable: '@@session.time_zone' | ||
- statement_terminator: ; | ||
- statement: | ||
select_statement: | ||
select_clause: | ||
keyword: SELECT | ||
select_clause_element: | ||
system_variable: '@@global.version' | ||
- statement_terminator: ; | ||
- statement: | ||
select_statement: | ||
select_clause: | ||
keyword: SELECT | ||
select_clause_element: | ||
system_variable: '@@session.rand_seed1' | ||
- statement_terminator: ; | ||
- statement: | ||
select_statement: | ||
select_clause: | ||
keyword: SELECT | ||
select_clause_element: | ||
function: | ||
function_name: | ||
function_name_identifier: CONVERT_TZ | ||
bracketed: | ||
- start_bracket: ( | ||
- expression: | ||
function: | ||
function_name: | ||
function_name_identifier: NOW | ||
bracketed: | ||
start_bracket: ( | ||
end_bracket: ) | ||
- comma: ',' | ||
- expression: | ||
system_variable: '@@global.time_zone' | ||
- comma: ',' | ||
- expression: | ||
literal: "'+00:00'" | ||
- end_bracket: ) |