From aa78739628f2282a4abc5e8debb87a4eeb5dab92 Mon Sep 17 00:00:00 2001 From: Dan Ungureanu Date: Sun, 16 Aug 2015 22:50:55 +0300 Subject: [PATCH] Fixes #11400. Updated sql-parser to udan11/sql-parser@1568adba1af7bf061354a30afd169e29fa43f133. Signed-off-by: Dan Ungureanu --- .../src/Components/AlterOperation.php | 84 ++++++++++--------- .../sql-parser/src/Components/IntoKeyword.php | 6 +- .../src/Components/PartitionDefinition.php | 2 +- .../src/Contexts/ContextMySql50000.php | 2 + .../src/Contexts/ContextMySql50100.php | 2 + .../src/Contexts/ContextMySql50500.php | 2 + .../src/Contexts/ContextMySql50600.php | 2 + .../src/Contexts/ContextMySql50700.php | 2 + 8 files changed, 60 insertions(+), 42 deletions(-) diff --git a/libraries/sql-parser/src/Components/AlterOperation.php b/libraries/sql-parser/src/Components/AlterOperation.php index 6b81a46235..c99d3911ae 100644 --- a/libraries/sql-parser/src/Components/AlterOperation.php +++ b/libraries/sql-parser/src/Components/AlterOperation.php @@ -31,47 +31,55 @@ class AlterOperation extends Component * @var array */ public static $OPTIONS = array( - 'ADD' => 3, - 'ALTER' => 3, - 'ANALYZE' => 3, - 'CHANGE' => 3, - 'CHECK' => 3, - 'COALESCE' => 3, - 'CONVERT' => 3, - 'DISABLE' => 3, - 'DISCARD' => 3, - 'DROP' => 3, - 'ENABLE' => 3, - 'IMPORT' => 3, - 'MODIFY' => 3, - 'OPTIMIZE' => 3, - 'ORDER' => 3, - 'PARTITION' => 3, - 'REBUILD' => 3, - 'REMOVE' => 3, - 'RENAME' => 3, - 'REORGANIZE' => 3, - 'REPAIR' => 3, - 'COLUMN' => 4, - 'CONSTRAINT' => 4, - 'DEFAULT' => 4, - 'TO' => 4, - 'BY' => 4, - 'FOREIGN' => 4, - 'FULLTEXT' => 4, - 'KEY' => 4, - 'KEYS' => 4, - 'PARTITIONING' => 4, - 'PRIMARY KEY' => 4, - 'SPATIAL' => 4, - 'TABLESPACE' => 4, - 'INDEX' => 4, + // table_options + 'ENGINE' => array(1, 'var='), + 'AUTO_INCREMENT' => array(1, 'var='), + 'AVG_ROW_LENGTH' => array(1, 'var'), + 'MAX_ROWS' => array(1, 'var'), + 'ROW_FORMAT' => array(1, 'var'), - 'DEFAULT CHARACTER SET' => array(5, 'var'), - 'DEFAULT CHARSET' => array(5, 'var'), + 'ADD' => 1, + 'ALTER' => 1, + 'ANALYZE' => 1, + 'CHANGE' => 1, + 'CHECK' => 1, + 'COALESCE' => 1, + 'CONVERT' => 1, + 'DISABLE' => 1, + 'DISCARD' => 1, + 'DROP' => 1, + 'ENABLE' => 1, + 'IMPORT' => 1, + 'MODIFY' => 1, + 'OPTIMIZE' => 1, + 'ORDER' => 1, + 'PARTITION' => 1, + 'REBUILD' => 1, + 'REMOVE' => 1, + 'RENAME' => 1, + 'REORGANIZE' => 1, + 'REPAIR' => 1, - 'COLLATE' => array(6, 'var'), + 'COLUMN' => 2, + 'CONSTRAINT' => 2, + 'DEFAULT' => 2, + 'TO' => 2, + 'BY' => 2, + 'FOREIGN' => 2, + 'FULLTEXT' => 2, + 'KEY' => 2, + 'KEYS' => 2, + 'PARTITIONING' => 2, + 'PRIMARY KEY' => 2, + 'SPATIAL' => 2, + 'TABLESPACE' => 2, + 'INDEX' => 2, + + 'DEFAULT CHARACTER SET' => array(3, 'var'), + 'DEFAULT CHARSET' => array(3, 'var'), + + 'COLLATE' => array(4, 'var'), ); /** diff --git a/libraries/sql-parser/src/Components/IntoKeyword.php b/libraries/sql-parser/src/Components/IntoKeyword.php index 7a91064b31..5e4afcbce4 100644 --- a/libraries/sql-parser/src/Components/IntoKeyword.php +++ b/libraries/sql-parser/src/Components/IntoKeyword.php @@ -138,12 +138,12 @@ class IntoKeyword extends Component */ public static function build($component) { - if ($component->type === 'OUTFILE') { - return 'OUTFILE "' . $component->dest . '"'; - } else { + if ($component->dest instanceof Expression) { $columns = !empty($component->columns) ? '(' . implode(', ', $component->columns) . ')' : ''; return Expression::build($component->dest) . $columns; + } else { + return 'OUTFILE "' . $component->dest . '"'; } } } diff --git a/libraries/sql-parser/src/Components/PartitionDefinition.php b/libraries/sql-parser/src/Components/PartitionDefinition.php index c46252d9fd..df6d3f6e4e 100644 --- a/libraries/sql-parser/src/Components/PartitionDefinition.php +++ b/libraries/sql-parser/src/Components/PartitionDefinition.php @@ -71,7 +71,7 @@ class PartitionDefinition extends Component /** * The expression used to defined this partition. * - * @var Expression + * @var Expression|string */ public $expr; diff --git a/libraries/sql-parser/src/Contexts/ContextMySql50000.php b/libraries/sql-parser/src/Contexts/ContextMySql50000.php index 42366983fe..5cbb47cdea 100644 --- a/libraries/sql-parser/src/Contexts/ContextMySql50000.php +++ b/libraries/sql-parser/src/Contexts/ContextMySql50000.php @@ -3,6 +3,8 @@ /** * Context for MySQL 5. * + * This file was auto-generated. + * * @package SqlParser * @subpackage Contexts * @link https://dev.mysql.com/doc/refman/5.0/en/keywords.html diff --git a/libraries/sql-parser/src/Contexts/ContextMySql50100.php b/libraries/sql-parser/src/Contexts/ContextMySql50100.php index 8da3d06152..34192ba1bc 100644 --- a/libraries/sql-parser/src/Contexts/ContextMySql50100.php +++ b/libraries/sql-parser/src/Contexts/ContextMySql50100.php @@ -3,6 +3,8 @@ /** * Context for MySQL 5.1. * + * This file was auto-generated. + * * @package SqlParser * @subpackage Contexts * @link https://dev.mysql.com/doc/refman/5.1/en/keywords.html diff --git a/libraries/sql-parser/src/Contexts/ContextMySql50500.php b/libraries/sql-parser/src/Contexts/ContextMySql50500.php index 16207dcb15..e8a32fe3a8 100644 --- a/libraries/sql-parser/src/Contexts/ContextMySql50500.php +++ b/libraries/sql-parser/src/Contexts/ContextMySql50500.php @@ -3,6 +3,8 @@ /** * Context for MySQL 5.5. * + * This file was auto-generated. + * * @package SqlParser * @subpackage Contexts * @link https://dev.mysql.com/doc/refman/5.5/en/keywords.html diff --git a/libraries/sql-parser/src/Contexts/ContextMySql50600.php b/libraries/sql-parser/src/Contexts/ContextMySql50600.php index 4165140516..c09425b0b9 100644 --- a/libraries/sql-parser/src/Contexts/ContextMySql50600.php +++ b/libraries/sql-parser/src/Contexts/ContextMySql50600.php @@ -3,6 +3,8 @@ /** * Context for MySQL 5.6. * + * This file was auto-generated. + * * @package SqlParser * @subpackage Contexts * @link https://dev.mysql.com/doc/refman/5.6/en/keywords.html diff --git a/libraries/sql-parser/src/Contexts/ContextMySql50700.php b/libraries/sql-parser/src/Contexts/ContextMySql50700.php index 7d75a728a0..7e7a29d876 100644 --- a/libraries/sql-parser/src/Contexts/ContextMySql50700.php +++ b/libraries/sql-parser/src/Contexts/ContextMySql50700.php @@ -3,6 +3,8 @@ /** * Context for MySQL 5.7. * + * This file was auto-generated. + * * @package SqlParser * @subpackage Contexts * @link https://dev.mysql.com/doc/refman/5.7/en/keywords.html