From 5e3db35df11a394033f24062e679dca8633684b2 Mon Sep 17 00:00:00 2001 From: Dan Ungureanu Date: Wed, 30 Sep 2015 11:42:31 +0300 Subject: [PATCH] Added support for OUTER as an optional keyword in joins. --- src/Components/JoinKeyword.php | 2 ++ src/Contexts/ContextMySql50000.php | 4 ++-- src/Contexts/ContextMySql50100.php | 4 ++-- src/Contexts/ContextMySql50500.php | 4 ++-- src/Contexts/ContextMySql50600.php | 4 ++-- src/Contexts/ContextMySql50700.php | 4 ++-- src/Parser.php | 8 ++++++++ tools/contexts/_common.txt | 2 ++ 8 files changed, 22 insertions(+), 10 deletions(-) diff --git a/src/Components/JoinKeyword.php b/src/Components/JoinKeyword.php index ac2fa02db..2a7693efa 100644 --- a/src/Components/JoinKeyword.php +++ b/src/Components/JoinKeyword.php @@ -35,7 +35,9 @@ class JoinKeyword extends Component 'INNER JOIN' => 'INNER', 'JOIN' => 'JOIN', 'LEFT JOIN' => 'LEFT', + 'LEFT OUTER JOIN' => 'LEFT', 'RIGHT JOIN' => 'RIGHT', + 'RIGHT OUTER JOIN' => 'RIGHT', ); /** diff --git a/src/Contexts/ContextMySql50000.php b/src/Contexts/ContextMySql50000.php index e5b63775e..01090b332 100644 --- a/src/Contexts/ContextMySql50000.php +++ b/src/Contexts/ContextMySql50000.php @@ -155,8 +155,8 @@ class ContextMySql50000 extends Context 'CHARACTER SET' => 7, 'IF NOT EXISTS' => 7, 'DATA DIRECTORY' => 7, 'DEFAULT CHARSET' => 7, 'DEFAULT COLLATE' => 7, 'INDEX DIRECTORY' => 7, - 'SUBPARTITION BY' => 7, - 'GENERATED ALWAYS' => 7, + 'LEFT OUTER JOIN' => 7, 'SUBPARTITION BY' => 7, + 'GENERATED ALWAYS' => 7, 'RIGHT OUTER JOIN' => 7, 'START TRANSACTION' => 7, 'SELECT TRANSACTION' => 7, 'DEFAULT CHARACTER SET' => 7, diff --git a/src/Contexts/ContextMySql50100.php b/src/Contexts/ContextMySql50100.php index 02e6afc09..b10ff1cd3 100644 --- a/src/Contexts/ContextMySql50100.php +++ b/src/Contexts/ContextMySql50100.php @@ -168,8 +168,8 @@ class ContextMySql50100 extends Context 'CHARACTER SET' => 7, 'IF NOT EXISTS' => 7, 'DATA DIRECTORY' => 7, 'DEFAULT CHARSET' => 7, 'DEFAULT COLLATE' => 7, 'INDEX DIRECTORY' => 7, - 'SUBPARTITION BY' => 7, - 'GENERATED ALWAYS' => 7, + 'LEFT OUTER JOIN' => 7, 'SUBPARTITION BY' => 7, + 'GENERATED ALWAYS' => 7, 'RIGHT OUTER JOIN' => 7, 'START TRANSACTION' => 7, 'SELECT TRANSACTION' => 7, 'DEFAULT CHARACTER SET' => 7, diff --git a/src/Contexts/ContextMySql50500.php b/src/Contexts/ContextMySql50500.php index b0332b570..c7faa8477 100644 --- a/src/Contexts/ContextMySql50500.php +++ b/src/Contexts/ContextMySql50500.php @@ -173,8 +173,8 @@ class ContextMySql50500 extends Context 'CHARACTER SET' => 7, 'IF NOT EXISTS' => 7, 'DATA DIRECTORY' => 7, 'DEFAULT CHARSET' => 7, 'DEFAULT COLLATE' => 7, 'INDEX DIRECTORY' => 7, - 'SUBPARTITION BY' => 7, - 'GENERATED ALWAYS' => 7, + 'LEFT OUTER JOIN' => 7, 'SUBPARTITION BY' => 7, + 'GENERATED ALWAYS' => 7, 'RIGHT OUTER JOIN' => 7, 'START TRANSACTION' => 7, 'SELECT TRANSACTION' => 7, 'DEFAULT CHARACTER SET' => 7, diff --git a/src/Contexts/ContextMySql50600.php b/src/Contexts/ContextMySql50600.php index 46c027720..9854d37fb 100644 --- a/src/Contexts/ContextMySql50600.php +++ b/src/Contexts/ContextMySql50600.php @@ -178,8 +178,8 @@ class ContextMySql50600 extends Context 'CHARACTER SET' => 7, 'IF NOT EXISTS' => 7, 'DATA DIRECTORY' => 7, 'DEFAULT CHARSET' => 7, 'DEFAULT COLLATE' => 7, 'INDEX DIRECTORY' => 7, - 'SUBPARTITION BY' => 7, - 'GENERATED ALWAYS' => 7, + 'LEFT OUTER JOIN' => 7, 'SUBPARTITION BY' => 7, + 'GENERATED ALWAYS' => 7, 'RIGHT OUTER JOIN' => 7, 'START TRANSACTION' => 7, 'SELECT TRANSACTION' => 7, 'DEFAULT CHARACTER SET' => 7, diff --git a/src/Contexts/ContextMySql50700.php b/src/Contexts/ContextMySql50700.php index 817ed0a74..a308f5a5c 100644 --- a/src/Contexts/ContextMySql50700.php +++ b/src/Contexts/ContextMySql50700.php @@ -186,8 +186,8 @@ class ContextMySql50700 extends Context 'CHARACTER SET' => 7, 'IF NOT EXISTS' => 7, 'DATA DIRECTORY' => 7, 'DEFAULT CHARSET' => 7, 'DEFAULT COLLATE' => 7, 'INDEX DIRECTORY' => 7, - 'SUBPARTITION BY' => 7, - 'GENERATED ALWAYS' => 7, + 'LEFT OUTER JOIN' => 7, 'SUBPARTITION BY' => 7, + 'GENERATED ALWAYS' => 7, 'RIGHT OUTER JOIN' => 7, 'START TRANSACTION' => 7, 'SELECT TRANSACTION' => 7, 'DEFAULT CHARACTER SET' => 7, diff --git a/src/Parser.php b/src/Parser.php index 1859ae0ed..1280d7287 100644 --- a/src/Parser.php +++ b/src/Parser.php @@ -172,10 +172,18 @@ class Parser 'class' => 'SqlParser\\Components\\JoinKeyword', 'field' => 'join', ), + 'LEFT OUTER JOIN' => array( + 'class' => 'SqlParser\\Components\\JoinKeyword', + 'field' => 'join', + ), 'RIGHT JOIN' => array( 'class' => 'SqlParser\\Components\\JoinKeyword', 'field' => 'join', ), + 'RIGHT OUTER JOIN' => array( + 'class' => 'SqlParser\\Components\\JoinKeyword', + 'field' => 'join', + ), 'INNER JOIN' => array( 'class' => 'SqlParser\\Components\\JoinKeyword', 'field' => 'join', diff --git a/tools/contexts/_common.txt b/tools/contexts/_common.txt index 1282f4f60..246fc0752 100644 --- a/tools/contexts/_common.txt +++ b/tools/contexts/_common.txt @@ -39,6 +39,7 @@ INTERVAL (D) JSON (D) KEY (K) LEFT JOIN +LEFT OUTER JOIN LESS THAN LINEAR HASH LINEAR KEY @@ -62,6 +63,7 @@ PERSISTENT PRIMARY KEY (K) REAL (D) RIGHT JOIN +RIGHT OUTER JOIN SELECT TRANSACTION SERIAL (D) SET (D)