diff options
-rw-r--r-- | CHANGELOG.md | 1 | ||||
-rw-r--r-- | src/Parser.php | 15 | ||||
-rw-r--r-- | src/Statement.php | 7 | ||||
-rw-r--r-- | src/Statements/SelectStatement.php | 2 |
4 files changed, 23 insertions, 2 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 1078114..4853319 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ ## [Unreleased] * Initial support for MariaDB SQL contexts. +* Add support for MariaDB 10.3 INTERSECT and EXCEPT. ## [4.1.10] - 2017-08-21 diff --git a/src/Parser.php b/src/Parser.php index 9ef7deb..88451f0 100644 --- a/src/Parser.php +++ b/src/Parser.php @@ -110,6 +110,14 @@ class Parser extends Core 'field' => 'end_options', ), + 'INTERSECT' => array( + 'class' => 'PhpMyAdmin\\SqlParser\\Components\\UnionKeyword', + 'field' => 'union', + ), + 'EXCEPT' => array( + 'class' => 'PhpMyAdmin\\SqlParser\\Components\\UnionKeyword', + 'field' => 'union', + ), 'UNION' => array( 'class' => 'PhpMyAdmin\\SqlParser\\Components\\UnionKeyword', 'field' => 'union', @@ -427,7 +435,12 @@ class Parser extends Core continue; } - if (($token->keyword === 'UNION') || ($token->keyword === 'UNION ALL') || ($token->keyword === 'UNION DISTINCT')) { + if (($token->keyword === 'UNION') || + ($token->keyword === 'UNION ALL') || + ($token->keyword === 'UNION DISTINCT') || + ($token->keyword === 'EXCEPT') || + ($token->keyword === 'INTERSECT') + ) { $unionType = $token->keyword; continue; } diff --git a/src/Statement.php b/src/Statement.php index ab554c3..59850d6 100644 --- a/src/Statement.php +++ b/src/Statement.php @@ -246,7 +246,12 @@ abstract class Statement // Unions are parsed by the parser because they represent more than // one statement. - if (($token->value === 'UNION') || ($token->value === 'UNION ALL') || ($token->value === 'UNION DISTINCT')) { + if (($token->keyword === 'UNION') || + ($token->keyword === 'UNION ALL') || + ($token->keyword === 'UNION DISTINCT') || + ($token->keyword === 'EXCEPT') || + ($token->keyword === 'INTERSECT') + ) { break; } diff --git a/src/Statements/SelectStatement.php b/src/Statements/SelectStatement.php index deee68a..3dd0416 100644 --- a/src/Statements/SelectStatement.php +++ b/src/Statements/SelectStatement.php @@ -112,6 +112,8 @@ class SelectStatement extends Statement 'LIMIT' => array('LIMIT', 3), 'PROCEDURE' => array('PROCEDURE', 3), 'UNION' => array('UNION', 1), + 'EXCEPT' => array('EXCEPT', 1), + 'INTERSECT' => array('INTERSECT', 1), '_END_OPTIONS' => array('_END_OPTIONS', 1), // These are available only when `UNION` is present. // 'ORDER BY' => array('ORDER BY', 3), |