summaryrefslogtreecommitdiffstats
path: root/src/Components
diff options
context:
space:
mode:
Diffstat (limited to 'src/Components')
-rw-r--r--src/Components/AlterOperation.php102
-rw-r--r--src/Components/ArrayObj.php2
-rw-r--r--src/Components/CaseExpression.php2
-rw-r--r--src/Components/Condition.php12
-rw-r--r--src/Components/CreateDefinition.php40
-rw-r--r--src/Components/DataType.php18
-rw-r--r--src/Components/Expression.php12
-rw-r--r--src/Components/IntoKeyword.php36
-rw-r--r--src/Components/JoinKeyword.php8
-rw-r--r--src/Components/Key.php20
-rw-r--r--src/Components/LockExpression.php2
-rw-r--r--src/Components/OptionsArray.php14
-rw-r--r--src/Components/PartitionDefinition.php52
-rw-r--r--src/Components/Reference.php22
-rw-r--r--src/Components/RenameOperation.php12
-rw-r--r--src/Components/SetOperation.php6
16 files changed, 180 insertions, 180 deletions
diff --git a/src/Components/AlterOperation.php b/src/Components/AlterOperation.php
index fc06644..d55f155 100644
--- a/src/Components/AlterOperation.php
+++ b/src/Components/AlterOperation.php
@@ -25,67 +25,67 @@ class AlterOperation extends Component
*
* @var array
*/
- public static $DB_OPTIONS = [
- 'CHARACTER SET' => [
+ public static $DB_OPTIONS = array(
+ 'CHARACTER SET' => array(
1,
- 'var',
- ],
- 'CHARSET' => [
+ 'var'
+ ),
+ 'CHARSET' => array(
1,
- 'var',
- ],
- 'DEFAULT CHARACTER SET' => [
+ 'var'
+ ),
+ 'DEFAULT CHARACTER SET' => array(
1,
- 'var',
- ],
- 'DEFAULT CHARSET' => [
+ 'var'
+ ),
+ 'DEFAULT CHARSET' => array(
1,
- 'var',
- ],
- 'UPGRADE' => [
+ 'var'
+ ),
+ 'UPGRADE' => array(
1,
- 'var',
- ],
- 'COLLATE' => [
+ 'var'
+ ),
+ 'COLLATE' => array(
2,
- 'var',
- ],
- 'DEFAULT COLLATE' => [
+ 'var'
+ ),
+ 'DEFAULT COLLATE' => array(
2,
- 'var',
- ],
- ];
+ 'var'
+ )
+ );
/**
* All table options.
*
* @var array
*/
- public static $TABLE_OPTIONS = [
- 'ENGINE' => [
+ public static $TABLE_OPTIONS = array(
+ 'ENGINE' => array(
1,
- 'var=',
- ],
- 'AUTO_INCREMENT' => [
+ 'var='
+ ),
+ 'AUTO_INCREMENT' => array(
1,
- 'var=',
- ],
- 'AVG_ROW_LENGTH' => [
+ 'var='
+ ),
+ 'AVG_ROW_LENGTH' => array(
1,
- 'var',
- ],
- 'MAX_ROWS' => [
+ 'var'
+ ),
+ 'MAX_ROWS' => array(
1,
- 'var',
- ],
- 'ROW_FORMAT' => [
+ 'var'
+ ),
+ 'ROW_FORMAT' => array(
1,
- 'var',
- ],
- 'COMMENT' => [
+ 'var'
+ ),
+ 'COMMENT' => array(
1,
- 'var',
- ],
+ 'var'
+ ),
'ADD' => 1,
'ALTER' => 1,
'ANALYZE' => 1,
@@ -122,17 +122,17 @@ class AlterOperation extends Component
'PRIMARY KEY' => 2,
'SPATIAL' => 2,
'TABLESPACE' => 2,
- 'INDEX' => 2,
- ];
+ 'INDEX' => 2
+ );
/**
* All view options.
*
* @var array
*/
- public static $VIEW_OPTIONS = [
+ public static $VIEW_OPTIONS = array(
'AS' => 1,
- ];
+ );
/**
* Options of this operation.
@@ -251,10 +251,10 @@ class AlterOperation extends Component
$ret->field = Expression::parse(
$parser,
$list,
- [
+ array(
'breakOnAlias' => true,
- 'parseField' => 'column',
- ]
+ 'parseField' => 'column'
+ )
);
if ($ret->field === null) {
// No field was read. We go back one token so the next
@@ -334,13 +334,13 @@ class AlterOperation extends Component
*/
private static function checkIfColumnDefinitionKeyword($tokenValue)
{
- $common_options = [
+ $common_options = array(
'AUTO_INCREMENT',
'COMMENT',
'DEFAULT',
'CHARACTER SET',
'COLLATE'
- ];
+ );
// Since these options can be used for
// both table as well as a specific column in the table
return in_array($tokenValue, $common_options);
diff --git a/src/Components/ArrayObj.php b/src/Components/ArrayObj.php
index 769ce37..1edfe6d 100644
--- a/src/Components/ArrayObj.php
+++ b/src/Components/ArrayObj.php
@@ -144,7 +144,7 @@ class ArrayObj extends Component
$ret[] = $options['type']::parse(
$parser,
$list,
- empty($options['typeOptions']) ? [] : $options['typeOptions']
+ empty($options['typeOptions']) ? array() : $options['typeOptions']
);
}
}
diff --git a/src/Components/CaseExpression.php b/src/Components/CaseExpression.php
index 468cf6d..4d5189f 100644
--- a/src/Components/CaseExpression.php
+++ b/src/Components/CaseExpression.php
@@ -216,7 +216,7 @@ class CaseExpression extends Component
if ($token->type === Token::TYPE_DELIMITER) {
break;
}
-
+
// Skipping whitespaces and comments.
if (($token->type === Token::TYPE_WHITESPACE)
|| ($token->type === Token::TYPE_COMMENT)
diff --git a/src/Components/Condition.php b/src/Components/Condition.php
index edf01b0..e661a63 100644
--- a/src/Components/Condition.php
+++ b/src/Components/Condition.php
@@ -25,20 +25,20 @@ class Condition extends Component
*
* @var array
*/
- public static $DELIMITERS = [
+ public static $DELIMITERS = array(
'&&',
'||',
'AND',
'OR',
- 'XOR',
- ];
+ 'XOR'
+ );
/**
* List of allowed reserved keywords in conditions.
*
* @var array
*/
- public static $ALLOWED_KEYWORDS = [
+ public static $ALLOWED_KEYWORDS = array(
'ALL' => 1,
'AND' => 1,
'BETWEEN' => 1,
@@ -56,8 +56,8 @@ class Condition extends Component
'OR' => 1,
'REGEXP' => 1,
'RLIKE' => 1,
- 'XOR' => 1,
- ];
+ 'XOR' => 1
+ );
/**
* Identifiers recognized.
diff --git a/src/Components/CreateDefinition.php b/src/Components/CreateDefinition.php
index 506832a..922551b 100644
--- a/src/Components/CreateDefinition.php
+++ b/src/Components/CreateDefinition.php
@@ -30,56 +30,56 @@ class CreateDefinition extends Component
*
* @var array
*/
- public static $FIELD_OPTIONS = [
+ public static $FIELD_OPTIONS = array(
// Tells the `OptionsArray` to not sort the options.
// See the note below.
'_UNSORTED' => true,
'NOT NULL' => 1,
'NULL' => 1,
- 'DEFAULT' => [
+ 'DEFAULT' => array(
2,
'expr',
- ['breakOnAlias' => true],
- ],
+ array('breakOnAlias' => true)
+ ),
/* Following are not according to grammar, but MySQL happily accepts
* these at any location */
- 'CHARSET' => [
+ 'CHARSET' => array(
2,
'var',
- ],
- 'COLLATE' => [
+ ),
+ 'COLLATE' => array(
3,
'var',
- ],
+ ),
'AUTO_INCREMENT' => 3,
'PRIMARY' => 4,
'PRIMARY KEY' => 4,
'UNIQUE' => 4,
'UNIQUE KEY' => 4,
- 'COMMENT' => [
+ 'COMMENT' => array(
5,
'var',
- ],
- 'COLUMN_FORMAT' => [
+ ),
+ 'COLUMN_FORMAT' => array(
6,
'var',
- ],
- 'ON UPDATE' => [
+ ),
+ 'ON UPDATE' => array(
7,
'expr',
- ],
+ ),
// Generated columns options.
'GENERATED ALWAYS' => 8,
- 'AS' => [
+ 'AS' => array(
9,
'expr',
- ['parenthesesDelimited' => true],
- ],
+ array('parenthesesDelimited' => true)
+ ),
'VIRTUAL' => 10,
'PERSISTENT' => 11,
- 'STORED' => 11,
+ 'STORED' => 11
// Common entries.
//
// NOTE: Some of the common options are not in the same order which
@@ -94,7 +94,7 @@ class CreateDefinition extends Component
// 'NULL' => 1,
// 'PRIMARY' => 4,
// 'PRIMARY KEY' => 4,
- ];
+ );
/**
* The name of the new column.
@@ -345,7 +345,7 @@ class CreateDefinition extends Component
if (! empty($component->type)) {
$tmp .= DataType::build(
$component->type,
- ['lowercase' => true]
+ array('lowercase' => true)
) . ' ';
}
diff --git a/src/Components/DataType.php b/src/Components/DataType.php
index 75a70fc..4af7a01 100644
--- a/src/Components/DataType.php
+++ b/src/Components/DataType.php
@@ -25,23 +25,23 @@ class DataType extends Component
*
* @var array
*/
- public static $DATA_TYPE_OPTIONS = [
+ public static $DATA_TYPE_OPTIONS = array(
'BINARY' => 1,
- 'CHARACTER SET' => [
+ 'CHARACTER SET' => array(
2,
'var',
- ],
- 'CHARSET' => [
+ ),
+ 'CHARSET' => array(
2,
'var',
- ],
- 'COLLATE' => [
+ ),
+ 'COLLATE' => array(
3,
'var',
- ],
+ ),
'UNSIGNED' => 4,
- 'ZEROFILL' => 5,
- ];
+ 'ZEROFILL' => 5
+ );
/**
* The name of the data type.
diff --git a/src/Components/Expression.php b/src/Components/Expression.php
index 1cac3a0..4608754 100644
--- a/src/Components/Expression.php
+++ b/src/Components/Expression.php
@@ -28,7 +28,7 @@ class Expression extends Component
*
* @var array
*/
- private static $ALLOWED_KEYWORDS = [
+ private static $ALLOWED_KEYWORDS = array(
'AS' => 1,
'DUAL' => 1,
'NULL' => 1,
@@ -39,8 +39,8 @@ class Expression extends Component
'OR' => 1,
'XOR' => 1,
'NOT' => 1,
- 'MOD' => 1,
- ];
+ 'MOD' => 1
+ );
/**
* The name of this database.
@@ -192,10 +192,10 @@ class Expression extends Component
*
* @var Token[]
*/
- $prev = [
+ $prev = array(
null,
- null,
- ];
+ null
+ );
// When a field is parsed, no parentheses are expected.
if (! empty($options['parseField'])) {
diff --git a/src/Components/IntoKeyword.php b/src/Components/IntoKeyword.php
index 79c3f3f..593088c 100644
--- a/src/Components/IntoKeyword.php
+++ b/src/Components/IntoKeyword.php
@@ -25,37 +25,37 @@ class IntoKeyword extends Component
*
* @var array
*/
- public static $FIELDS_OPTIONS = [
- 'TERMINATED BY' => [
+ public static $FIELDS_OPTIONS = array(
+ 'TERMINATED BY' => array(
1,
'expr',
- ],
+ ),
'OPTIONALLY' => 2,
- 'ENCLOSED BY' => [
+ 'ENCLOSED BY' => array(
3,
'expr',
- ],
- 'ESCAPED BY' => [
+ ),
+ 'ESCAPED BY' => array(
4,
'expr',
- ],
- ];
+ )
+ );
/**
* LINES Options for `SELECT...INTO` statements.
*
* @var array
*/
- public static $LINES_OPTIONS = [
- 'STARTING BY' => [
+ public static $LINES_OPTIONS = array(
+ 'STARTING BY' => array(
1,
'expr',
- ],
- 'TERMINATED BY' => [
+ ),
+ 'TERMINATED BY' => array(
2,
'expr',
- ],
- ];
+ )
+ );
/**
* Type of target (OUTFILE or SYMBOL).
@@ -203,10 +203,10 @@ class IntoKeyword extends Component
$ret->dest = Expression::parse(
$parser,
$list,
- [
+ array(
'parseField' => 'table',
- 'breakOnAlias' => true,
- ]
+ 'breakOnAlias' => true
+ )
);
} else {
$ret->values = ExpressionArray::parse($parser, $list);
@@ -287,7 +287,7 @@ class IntoKeyword extends Component
$ret .= ' ' . $fields_options_str;
}
- $lines_options_str = OptionsArray::build($component->lines_options, ['expr' => true]);
+ $lines_options_str = OptionsArray::build($component->lines_options, array('expr' => true));
if (trim($lines_options_str) !== '') {
$ret .= ' LINES ' . $lines_options_str;
}
diff --git a/src/Components/JoinKeyword.php b/src/Components/JoinKeyword.php
index 9da28e0..6b630ba 100644
--- a/src/Components/JoinKeyword.php
+++ b/src/Components/JoinKeyword.php
@@ -25,7 +25,7 @@ class JoinKeyword extends Component
*
* @var array
*/
- public static $JOINS = [
+ public static $JOINS = array(
'CROSS JOIN' => 'CROSS',
'FULL JOIN' => 'FULL',
'FULL OUTER JOIN' => 'FULL',
@@ -40,8 +40,8 @@ class JoinKeyword extends Component
'NATURAL RIGHT JOIN' => 'NATURAL RIGHT',
'NATURAL LEFT OUTER JOIN' => 'NATURAL LEFT OUTER',
'NATURAL RIGHT OUTER JOIN' => 'NATURAL RIGHT OUTER',
- 'STRAIGHT_JOIN' => 'STRAIGHT',
- ];
+ 'STRAIGHT_JOIN' => 'STRAIGHT'
+ );
/**
* Type of this join.
@@ -159,7 +159,7 @@ class JoinKeyword extends Component
break;
}
} elseif ($state === 1) {
- $expr->expr = Expression::parse($parser, $list, ['field' => 'table']);
+ $expr->expr = Expression::parse($parser, $list, array('field' => 'table'));
$state = 2;
} elseif ($state === 2) {
if ($token->type === Token::TYPE_KEYWORD) {
diff --git a/src/Components/Key.php b/src/Components/Key.php
index e72300f..6e4fd6b 100644
--- a/src/Components/Key.php
+++ b/src/Components/Key.php
@@ -28,24 +28,24 @@ class Key extends Component
*
* @var array
*/
- public static $KEY_OPTIONS = [
- 'KEY_BLOCK_SIZE' => [
+ public static $KEY_OPTIONS = array(
+ 'KEY_BLOCK_SIZE' => array(
1,
'var',
- ],
- 'USING' => [
+ ),
+ 'USING' => array(
2,
'var',
- ],
- 'WITH PARSER' => [
+ ),
+ 'WITH PARSER' => array(
3,
'var',
- ],
- 'COMMENT' => [
+ ),
+ 'COMMENT' => array(
4,
'var=',
- ],
- ];
+ )
+ );
/**
* The name of this key.
diff --git a/src/Components/LockExpression.php b/src/Components/LockExpression.php
index c1ee848..ecbe0ee 100644
--- a/src/Components/LockExpression.php
+++ b/src/Components/LockExpression.php
@@ -77,7 +77,7 @@ class LockExpression extends Component
}
if ($state === 0) {
- $ret->table = Expression::parse($parser, $list, ['parseField' => 'table']);
+ $ret->table = Expression::parse($parser, $list, array('parseField' => 'table'));
$state = 1;
} elseif ($state === 1) {
// parse lock type
diff --git a/src/Components/OptionsArray.php b/src/Components/OptionsArray.php
index 40b07a3..4cd35d2 100644
--- a/src/Components/OptionsArray.php
+++ b/src/Components/OptionsArray.php
@@ -167,7 +167,7 @@ class OptionsArray extends Component
// This is only the beginning. The value is parsed in state
// 1 and 2. State 1 is used to skip the first equals sign
// and state 2 to parse the actual value.
- $ret->options[$lastOptionId] = [
+ $ret->options[$lastOptionId] = array(
// @var string The name of the option.
'name' => $token->value,
// @var bool Whether it contains an equal sign.
@@ -176,8 +176,8 @@ class OptionsArray extends Component
// @var string Raw value.
'expr' => '',
// @var string Processed value.
- 'value' => '',
- ];
+ 'value' => ''
+ );
$state = 1;
} elseif ($lastOption[1] === 'expr' || $lastOption[1] === 'expr=') {
// This is a keyword that is followed by an expression.
@@ -185,15 +185,15 @@ class OptionsArray extends Component
// Skipping this option in order to parse the expression.
++$list->idx;
- $ret->options[$lastOptionId] = [
+ $ret->options[$lastOptionId] = array(
// @var string The name of the option.
'name' => $token->value,
// @var bool Whether it contains an equal sign.
// This is used by the builder to rebuild it.
'equals' => $lastOption[1] === 'expr=',
// @var Expression The parsed expression.
- 'expr' => '',
- ];
+ 'expr' => ''
+ );
$state = 1;
}
} elseif ($state === 1) {
@@ -211,7 +211,7 @@ class OptionsArray extends Component
$ret->options[$lastOptionId]['expr'] = Expression::parse(
$parser,
$list,
- empty($lastOption[2]) ? [] : $lastOption[2]
+ empty($lastOption[2]) ? array() : $lastOption[2]
);
$ret->options[$lastOptionId]['value']
= $ret->options[$lastOptionId]['expr']->expr;
diff --git a/src/Components/PartitionDefinition.php b/src/Components/PartitionDefinition.php
index b07317a..163ee7a 100644
--- a/src/Components/PartitionDefinition.php
+++ b/src/Components/PartitionDefinition.php
@@ -29,44 +29,44 @@ class PartitionDefinition extends Component
*
* @var array
*/
- public static $OPTIONS = [
- 'STORAGE ENGINE' => [
+ public static $OPTIONS = array(
+ 'STORAGE ENGINE' => array(
1,
'var',
- ],
- 'ENGINE' => [
+ ),
+ 'ENGINE' => array(
1,
'var',
- ],
- 'COMMENT' => [
+ ),
+ 'COMMENT' => array(
2,
'var',
- ],
- 'DATA DIRECTORY' => [
+ ),
+ 'DATA DIRECTORY' => array(
3,
'var',
- ],
- 'INDEX DIRECTORY' => [
+ ),
+ 'INDEX DIRECTORY' => array(
4,
'var',
- ],
- 'MAX_ROWS' => [
+ ),
+ 'MAX_ROWS' => array(
5,
'var',
- ],
- 'MIN_ROWS' => [
+ ),
+ 'MIN_ROWS' => array(
6,
'var',
- ],
- 'TABLESPACE' => [
+ ),
+ 'TABLESPACE' => array(
7,
'var',
- ],
- 'NODEGROUP' => [
+ ),
+ 'NODEGROUP' => array(
8,
'var',
- ],
- ];
+ )
+ );
/**
* Whether this entry is a subpartition or a partition.
@@ -190,10 +190,10 @@ class PartitionDefinition extends Component
$ret->expr = Expression::parse(
$parser,
$list,
- [
+ array(
'parenthesesDelimited' => true,
- 'breakOnAlias' => true,
- ]
+ 'breakOnAlias' => true
+ )
);
}
$state = 5;
@@ -205,9 +205,9 @@ class PartitionDefinition extends Component
$ret->subpartitions = ArrayObj::parse(
$parser,
$list,
- [
- 'type' => 'PhpMyAdmin\\SqlParser\\Components\\PartitionDefinition',
- ]
+ array(
+ 'type' => 'PhpMyAdmin\\SqlParser\\Components\\PartitionDefinition'
+ )
);
++$list->idx;
}
diff --git a/src/Components/Reference.php b/src/Components/Reference.php
index 3cec28f..56d639d 100644
--- a/src/Components/Reference.php
+++ b/src/Components/Reference.php
@@ -26,20 +26,20 @@ class Reference extends Component
*
* @var array
*/
- public static $REFERENCES_OPTIONS = [
- 'MATCH' => [
+ public static $REFERENCES_OPTIONS = array(
+ 'MATCH' => array(
1,
'var',
- ],
- 'ON DELETE' => [
+ ),
+ 'ON DELETE' => array(
2,
'var',
- ],
- 'ON UPDATE' => [
+ ),
+ 'ON UPDATE' => array(
3,
'var',
- ],
- ];
+ )
+ );
/**
* The referenced table.
@@ -124,10 +124,10 @@ class Reference extends Component
$ret->table = Expression::parse(
$parser,
$list,
- [
+ array(
'parseField' => 'table',
- 'breakOnAlias' => true,
- ]
+ 'breakOnAlias' => true
+ )
);
$state = 1;
} elseif ($state === 1) {
diff --git a/src/Components/RenameOperation.php b/src/Components/RenameOperation.php
index 169d6f7..785e07d 100644
--- a/src/Components/RenameOperation.php
+++ b/src/Components/RenameOperation.php
@@ -99,10 +99,10 @@ class RenameOperation extends Component
$expr->old = Expression::parse(
$parser,
$list,
- [
+ array(
'breakOnAlias' => true,
- 'parseField' => 'table',
- ]
+ 'parseField' => 'table'
+ )
);
if (empty($expr->old)) {
$parser->error(
@@ -125,10 +125,10 @@ class RenameOperation extends Component
$expr->new = Expression::parse(
$parser,
$list,
- [
+ array(
'breakOnAlias' => true,
- 'parseField' => 'table',
- ]
+ 'parseField' => 'table'
+ )
);
if (empty($expr->new)) {
$parser->error(
diff --git a/src/Components/SetOperation.php b/src/Components/SetOperation.php
index a4a55cc..308f65e 100644
--- a/src/Components/SetOperation.php
+++ b/src/Components/SetOperation.php
@@ -118,9 +118,9 @@ class SetOperation extends Component
$tmp = Expression::parse(
$parser,
$list,
- [
- 'breakOnAlias' => true,
- ]
+ array(
+ 'breakOnAlias' => true
+ )
);
if (is_null($tmp)) {
$parser->error('Missing expression.', $token);