summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWilliam Desportes <williamdes@wdes.fr>2019-05-28 13:00:00 +0200
committerWilliam Desportes <williamdes@wdes.fr>2019-05-28 15:08:34 +0200
commit930a860bc7f0684c45babd012070f88a9505d427 (patch)
tree40269b2466aa6585c8c65f42d02a00a496c2fa46
parent5d5089a259d0195c4a1e4aa3588c31c839954067 (diff)
downloadsql-parser-930a860bc7f0684c45babd012070f88a9505d427.zip
sql-parser-930a860bc7f0684c45babd012070f88a9505d427.tar.gz
sql-parser-930a860bc7f0684c45babd012070f88a9505d427.tar.bz2
revert of new array syntax
See: 86c5baebda24c1721fb6881df8671a3c7df60e8b Signed-off-by: William Desportes <williamdes@wdes.fr>
-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
-rw-r--r--src/Context.php6
-rw-r--r--src/Contexts/ContextMariaDb100000.php6
-rw-r--r--src/Contexts/ContextMariaDb100100.php6
-rw-r--r--src/Contexts/ContextMariaDb100200.php6
-rw-r--r--src/Contexts/ContextMariaDb100300.php6
-rw-r--r--src/Contexts/ContextMySql50000.php6
-rw-r--r--src/Contexts/ContextMySql50100.php6
-rw-r--r--src/Contexts/ContextMySql50500.php6
-rw-r--r--src/Contexts/ContextMySql50600.php6
-rw-r--r--src/Contexts/ContextMySql50700.php6
-rw-r--r--src/Contexts/ContextMySql80000.php6
-rw-r--r--src/Lexer.php6
-rw-r--r--src/Parser.php254
-rw-r--r--src/Statements/AlterStatement.php12
-rw-r--r--src/Statements/AnalyzeStatement.php10
-rw-r--r--src/Statements/BackupStatement.php10
-rw-r--r--src/Statements/CheckStatement.php8
-rw-r--r--src/Statements/ChecksumStatement.php8
-rw-r--r--src/Statements/CreateStatement.php192
-rw-r--r--src/Statements/DeleteStatement.php42
-rw-r--r--src/Statements/DropStatement.php26
-rw-r--r--src/Statements/InsertStatement.php6
-rw-r--r--src/Statements/LoadStatement.php34
-rw-r--r--src/Statements/OptimizeStatement.php6
-rw-r--r--src/Statements/PurgeStatement.php8
-rw-r--r--src/Statements/RepairStatement.php6
-rw-r--r--src/Statements/ReplaceStatement.php8
-rw-r--r--src/Statements/RestoreStatement.php8
-rw-r--r--src/Statements/SelectStatement.php162
-rw-r--r--src/Statements/SetStatement.php46
-rw-r--r--src/Statements/ShowStatement.php6
-rw-r--r--src/Statements/TransactionStatement.php6
-rw-r--r--src/Statements/TruncateStatement.php6
-rw-r--r--src/Statements/UpdateStatement.php38
-rw-r--r--src/Token.php8
-rw-r--r--src/Utils/BufferedQuery.php4
-rw-r--r--src/Utils/CLI.php22
-rw-r--r--src/Utils/Error.php12
-rw-r--r--src/Utils/Formatter.php76
-rw-r--r--src/Utils/Misc.php12
-rw-r--r--src/Utils/Query.php48
-rw-r--r--src/Utils/Routine.php40
-rw-r--r--src/Utils/Table.php12
-rw-r--r--tests/Builder/CreateStatementTest.php24
-rw-r--r--tests/Builder/InsertStatementTest.php2
-rw-r--r--tests/Components/Array2dTest.php4
-rw-r--r--tests/Components/ArrayObjTest.php20
-rw-r--r--tests/Components/ExpressionArrayTest.php14
-rw-r--r--tests/Components/ExpressionTest.php26
-rw-r--r--tests/Components/FunctionCallTest.php2
-rw-r--r--tests/Components/GroupKeywordTest.php4
-rw-r--r--tests/Components/JoinKeywordTest.php2
-rw-r--r--tests/Components/LimitTest.php8
-rw-r--r--tests/Components/LockExpressionTest.php22
-rw-r--r--tests/Components/OptionsArrayTest.php64
-rw-r--r--tests/Components/OrderKeywordTest.php6
-rw-r--r--tests/Components/ReferenceTest.php4
-rw-r--r--tests/Lexer/ContextTest.php60
-rw-r--r--tests/Lexer/LexerTest.php60
-rw-r--r--tests/Lexer/TokensListTest.php6
-rw-r--r--tests/Misc/BugsTest.php20
-rw-r--r--tests/Misc/ParameterTest.php6
-rw-r--r--tests/Misc/UtfStringTest.php20
-rw-r--r--tests/Parser/AlterStatementTest.php24
-rw-r--r--tests/Parser/CallStatementTest.php10
-rw-r--r--tests/Parser/CreateStatementTest.php62
-rw-r--r--tests/Parser/DeleteStatementTest.php54
-rw-r--r--tests/Parser/ExplainStatementTest.php6
-rw-r--r--tests/Parser/InsertStatementTest.php22
-rw-r--r--tests/Parser/LoadStatementTest.php28
-rw-r--r--tests/Parser/LockStatementTest.php38
-rw-r--r--tests/Parser/ParserTest.php14
-rw-r--r--tests/Parser/PurgeStatementTest.php18
-rw-r--r--tests/Parser/RenameStatementTest.php18
-rw-r--r--tests/Parser/ReplaceStatementTest.php22
-rw-r--r--tests/Parser/RestoreStatementTest.php6
-rw-r--r--tests/Parser/SelectStatementTest.php118
-rw-r--r--tests/Parser/SetStatementTest.php18
-rw-r--r--tests/Parser/TransactionStatementTest.php12
-rw-r--r--tests/Parser/UpdateStatementTest.php12
-rw-r--r--tests/TestCase.php10
-rw-r--r--tests/Utils/BufferedQueryTest.php88
-rw-r--r--tests/Utils/CLITest.php146
-rw-r--r--tests/Utils/ErrorTest.php14
-rw-r--r--tests/Utils/FormatterTest.php260
-rw-r--r--tests/Utils/MiscTest.php130
-rw-r--r--tests/Utils/QueryTest.php386
-rw-r--r--tests/Utils/RoutineTest.php264
-rw-r--r--tests/Utils/TableTest.php138
-rw-r--r--tests/Utils/TokensTest.php90
-rw-r--r--tools/ContextGenerator.php28
-rw-r--r--tools/TestGenerator.php20
108 files changed, 1998 insertions, 2000 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);
diff --git a/src/Context.php b/src/Context.php
index 9bfba17..4c83b62 100644
--- a/src/Context.php
+++ b/src/Context.php
@@ -93,7 +93,7 @@ abstract class Context
*
* @var array
*/
- public static $OPERATORS = [
+ public static $OPERATORS = array(
// Some operators (*, =) may have ambiguous flags, because they depend on
// the context they are being used in.
// For example: 1. SELECT * FROM table; # SQL specific (wildcard)
@@ -137,8 +137,8 @@ abstract class Context
')' => 16,
'.' => 16,
',' => 16,
- ';' => 16,
- ];
+ ';' => 16
+ );
/**
* The mode of the MySQL server that will be used in lexing, parsing and
diff --git a/src/Contexts/ContextMariaDb100000.php b/src/Contexts/ContextMariaDb100000.php
index cb0ac6e..8171c0c 100644
--- a/src/Contexts/ContextMariaDb100000.php
+++ b/src/Contexts/ContextMariaDb100000.php
@@ -33,7 +33,7 @@ class ContextMariaDb100000 extends Context
*
* @var array
*/
- public static $KEYWORDS = [
+ public static $KEYWORDS = array(
'AT' => 1, 'DO' => 1, 'IO' => 1, 'NO' => 1, 'XA' => 1,
'ANY' => 1, 'CPU' => 1, 'END' => 1, 'IPC' => 1, 'NDB' => 1, 'NEW' => 1,
'ONE' => 1, 'ROW' => 1,
@@ -311,6 +311,6 @@ class ContextMariaDb100000 extends Context
'CHAR' => 43,
'BINARY' => 43,
- 'INTERVAL' => 43,
- ];
+ 'INTERVAL' => 43
+ );
}
diff --git a/src/Contexts/ContextMariaDb100100.php b/src/Contexts/ContextMariaDb100100.php
index 7a419ab..5cfd747 100644
--- a/src/Contexts/ContextMariaDb100100.php
+++ b/src/Contexts/ContextMariaDb100100.php
@@ -33,7 +33,7 @@ class ContextMariaDb100100 extends Context
*
* @var array
*/
- public static $KEYWORDS = [
+ public static $KEYWORDS = array(
'AT' => 1, 'DO' => 1, 'IO' => 1, 'NO' => 1, 'XA' => 1,
'ANY' => 1, 'CPU' => 1, 'END' => 1, 'IPC' => 1, 'NDB' => 1, 'NEW' => 1,
'ONE' => 1, 'ROW' => 1, 'XID' => 1,
@@ -360,6 +360,6 @@ class ContextMariaDb100100 extends Context
'CHAR' => 43,
'BINARY' => 43,
- 'INTERVAL' => 43,
- ];
+ 'INTERVAL' => 43
+ );
}
diff --git a/src/Contexts/ContextMariaDb100200.php b/src/Contexts/ContextMariaDb100200.php
index e0923ad..860fc65 100644
--- a/src/Contexts/ContextMariaDb100200.php
+++ b/src/Contexts/ContextMariaDb100200.php
@@ -33,7 +33,7 @@ class ContextMariaDb100200 extends Context
*
* @var array
*/
- public static $KEYWORDS = [
+ public static $KEYWORDS = array(
'AT' => 1, 'DO' => 1, 'IO' => 1, 'NO' => 1, 'XA' => 1,
'ANY' => 1, 'CPU' => 1, 'END' => 1, 'IPC' => 1, 'NDB' => 1, 'NEW' => 1,
'ONE' => 1, 'ROW' => 1, 'XID' => 1,
@@ -360,6 +360,6 @@ class ContextMariaDb100200 extends Context
'CHAR' => 43,
'BINARY' => 43,
- 'INTERVAL' => 43,
- ];
+ 'INTERVAL' => 43
+ );
}
diff --git a/src/Contexts/ContextMariaDb100300.php b/src/Contexts/ContextMariaDb100300.php
index b162600..74dcd73 100644
--- a/src/Contexts/ContextMariaDb100300.php
+++ b/src/Contexts/ContextMariaDb100300.php
@@ -33,7 +33,7 @@ class ContextMariaDb100300 extends Context
*
* @var array
*/
- public static $KEYWORDS = [
+ public static $KEYWORDS = array(
'AT' => 1, 'DO' => 1, 'IO' => 1, 'NO' => 1, 'XA' => 1,
'ANY' => 1, 'CPU' => 1, 'END' => 1, 'IPC' => 1, 'NDB' => 1, 'NEW' => 1,
'ONE' => 1, 'ROW' => 1, 'XID' => 1,
@@ -360,6 +360,6 @@ class ContextMariaDb100300 extends Context
'CHAR' => 43,
'BINARY' => 43,
- 'INTERVAL' => 43,
- ];
+ 'INTERVAL' => 43
+ );
}
diff --git a/src/Contexts/ContextMySql50000.php b/src/Contexts/ContextMySql50000.php
index 5a8322b..877336f 100644
--- a/src/Contexts/ContextMySql50000.php
+++ b/src/Contexts/ContextMySql50000.php
@@ -33,7 +33,7 @@ class ContextMySql50000 extends Context
*
* @var array
*/
- public static $KEYWORDS = [
+ public static $KEYWORDS = array(
'DO' => 1, 'IO' => 1, 'NO' => 1, 'XA' => 1,
'ANY' => 1, 'BDB' => 1, 'CPU' => 1, 'END' => 1, 'IPC' => 1, 'NDB' => 1,
'NEW' => 1, 'ONE' => 1, 'ROW' => 1,
@@ -281,6 +281,6 @@ class ContextMySql50000 extends Context
'CHAR' => 43,
'BINARY' => 43,
- 'INTERVAL' => 43,
- ];
+ 'INTERVAL' => 43
+ );
}
diff --git a/src/Contexts/ContextMySql50100.php b/src/Contexts/ContextMySql50100.php
index e4d353e..1c8bb5a 100644
--- a/src/Contexts/ContextMySql50100.php
+++ b/src/Contexts/ContextMySql50100.php
@@ -33,7 +33,7 @@ class ContextMySql50100 extends Context
*
* @var array
*/
- public static $KEYWORDS = [
+ public static $KEYWORDS = array(
'AT' => 1, 'DO' => 1, 'IO' => 1, 'NO' => 1, 'XA' => 1,
'ANY' => 1, 'BDB' => 1, 'CPU' => 1, 'END' => 1, 'IPC' => 1, 'NDB' => 1,
'NEW' => 1, 'ONE' => 1, 'ROW' => 1,
@@ -306,6 +306,6 @@ class ContextMySql50100 extends Context
'CHAR' => 43,
'BINARY' => 43,
- 'INTERVAL' => 43,
- ];
+ 'INTERVAL' => 43
+ );
}
diff --git a/src/Contexts/ContextMySql50500.php b/src/Contexts/ContextMySql50500.php
index 2ef9b81..2b21deb 100644
--- a/src/Contexts/ContextMySql50500.php
+++ b/src/Contexts/ContextMySql50500.php
@@ -33,7 +33,7 @@ class ContextMySql50500 extends Context
*
* @var array
*/
- public static $KEYWORDS = [
+ public static $KEYWORDS = array(
'AT' => 1, 'DO' => 1, 'IO' => 1, 'NO' => 1, 'XA' => 1,
'ANY' => 1, 'CPU' => 1, 'END' => 1, 'IPC' => 1, 'NDB' => 1, 'NEW' => 1,
'ONE' => 1, 'ROW' => 1,
@@ -311,6 +311,6 @@ class ContextMySql50500 extends Context
'CHAR' => 43,
'BINARY' => 43,
- 'INTERVAL' => 43,
- ];
+ 'INTERVAL' => 43
+ );
}
diff --git a/src/Contexts/ContextMySql50600.php b/src/Contexts/ContextMySql50600.php
index 5fa8786..bec0d5f 100644
--- a/src/Contexts/ContextMySql50600.php
+++ b/src/Contexts/ContextMySql50600.php
@@ -33,7 +33,7 @@ class ContextMySql50600 extends Context
*
* @var array
*/
- public static $KEYWORDS = [
+ public static $KEYWORDS = array(
'AT' => 1, 'DO' => 1, 'IO' => 1, 'NO' => 1, 'XA' => 1,
'ANY' => 1, 'CPU' => 1, 'END' => 1, 'IPC' => 1, 'NDB' => 1, 'NEW' => 1,
'ONE' => 1, 'ROW' => 1,
@@ -340,6 +340,6 @@ class ContextMySql50600 extends Context
'CHAR' => 43,
'BINARY' => 43,
- 'INTERVAL' => 43,
- ];
+ 'INTERVAL' => 43
+ );
}
diff --git a/src/Contexts/ContextMySql50700.php b/src/Contexts/ContextMySql50700.php
index 6f24dc1..8bb7a8b 100644
--- a/src/Contexts/ContextMySql50700.php
+++ b/src/Contexts/ContextMySql50700.php
@@ -33,7 +33,7 @@ class ContextMySql50700 extends Context
*
* @var array
*/
- public static $KEYWORDS = [
+ public static $KEYWORDS = array(
'AT' => 1, 'DO' => 1, 'IO' => 1, 'NO' => 1, 'XA' => 1,
'ANY' => 1, 'CPU' => 1, 'END' => 1, 'IPC' => 1, 'NDB' => 1, 'NEW' => 1,
'ONE' => 1, 'ROW' => 1, 'XID' => 1,
@@ -360,6 +360,6 @@ class ContextMySql50700 extends Context
'CHAR' => 43,
'BINARY' => 43,
- 'INTERVAL' => 43,
- ];
+ 'INTERVAL' => 43
+ );
}
diff --git a/src/Contexts/ContextMySql80000.php b/src/Contexts/ContextMySql80000.php
index df581f5..b673484 100644
--- a/src/Contexts/ContextMySql80000.php
+++ b/src/Contexts/ContextMySql80000.php
@@ -33,7 +33,7 @@ class ContextMySql80000 extends Context
*
* @var array
*/
- public static $KEYWORDS = [
+ public static $KEYWORDS = array(
'AT' => 1, 'DO' => 1, 'IO' => 1, 'NO' => 1, 'XA' => 1,
'ANY' => 1, 'CPU' => 1, 'END' => 1, 'IPC' => 1, 'NDB' => 1, 'NEW' => 1,
'ONE' => 1, 'ROW' => 1, 'XID' => 1,
@@ -360,6 +360,6 @@ class ContextMySql80000 extends Context
'CHAR' => 43,
'BINARY' => 43,
- 'INTERVAL' => 43,
- ];
+ 'INTERVAL' => 43
+ );
}
diff --git a/src/Lexer.php b/src/Lexer.php
index 7fc1a75..30bece7 100644
--- a/src/Lexer.php
+++ b/src/Lexer.php
@@ -46,7 +46,7 @@ class Lexer extends Core
*
* @var array
*/
- public static $PARSER_METHODS = [
+ public static $PARSER_METHODS = array(
// It is best to put the parsers in order of their complexity
// (ascending) and their occurrence rate (descending).
//
@@ -80,8 +80,8 @@ class Lexer extends Core
'parseSymbol',
'parseKeyword',
'parseLabel',
- 'parseUnknown',
- ];
+ 'parseUnknown'
+ );
/**
* The string to be parsed.
diff --git a/src/Parser.php b/src/Parser.php
index f38914f..ba19861 100644
--- a/src/Parser.php
+++ b/src/Parser.php
@@ -27,7 +27,7 @@ class Parser extends Core
*
* @var array
*/
- public static $STATEMENT_PARSERS = [
+ public static $STATEMENT_PARSERS = array(
// MySQL Utility Statements
'DESCRIBE' => 'PhpMyAdmin\\SqlParser\\Statements\\ExplainStatement',
'DESC' => 'PhpMyAdmin\\SqlParser\\Statements\\ExplainStatement',
@@ -92,247 +92,247 @@ class Parser extends Core
// Lock statements
// https://dev.mysql.com/doc/refman/5.7/en/lock-tables.html
'LOCK' => 'PhpMyAdmin\\SqlParser\\Statements\\LockStatement',
- 'UNLOCK' => 'PhpMyAdmin\\SqlParser\\Statements\\LockStatement',
- ];
+ 'UNLOCK' => 'PhpMyAdmin\\SqlParser\\Statements\\LockStatement'
+ );
/**
* Array of classes that are used in parsing SQL components.
*
* @var array
*/
- public static $KEYWORD_PARSERS = [
+ public static $KEYWORD_PARSERS = array(
// This is not a proper keyword and was added here to help the
// formatter.
- 'PARTITION BY' => [],
- 'SUBPARTITION BY' => [],
+ 'PARTITION BY' => array(),
+ 'SUBPARTITION BY' => array(),
// This is not a proper keyword and was added here to help the
// builder.
- '_OPTIONS' => [
+ '_OPTIONS' => array(
'class' => 'PhpMyAdmin\\SqlParser\\Components\\OptionsArray',
'field' => 'options',
- ],
- '_END_OPTIONS' => [
+ ),
+ '_END_OPTIONS' => array(
'class' => 'PhpMyAdmin\\SqlParser\\Components\\OptionsArray',
'field' => 'end_options',
- ],
+ ),
- 'INTERSECT' => [
+ 'INTERSECT' => array(
'class' => 'PhpMyAdmin\\SqlParser\\Components\\UnionKeyword',
'field' => 'union',
- ],
- 'EXCEPT' => [
+ ),
+ 'EXCEPT' => array(
'class' => 'PhpMyAdmin\\SqlParser\\Components\\UnionKeyword',
'field' => 'union',
- ],
- 'UNION' => [
+ ),
+ 'UNION' => array(
'class' => 'PhpMyAdmin\\SqlParser\\Components\\UnionKeyword',
'field' => 'union',
- ],
- 'UNION ALL' => [
+ ),
+ 'UNION ALL' => array(
'class' => 'PhpMyAdmin\\SqlParser\\Components\\UnionKeyword',
'field' => 'union',
- ],
- 'UNION DISTINCT' => [
+ ),
+ 'UNION DISTINCT' => array(
'class' => 'PhpMyAdmin\\SqlParser\\Components\\UnionKeyword',
'field' => 'union',
- ],
+ ),
// Actual clause parsers.
- 'ALTER' => [
+ 'ALTER' => array(
'class' => 'PhpMyAdmin\\SqlParser\\Components\\Expression',
'field' => 'table',
- 'options' => ['parseField' => 'table'],
- ],
- 'ANALYZE' => [
+ 'options' => array('parseField' => 'table'),
+ ),
+ 'ANALYZE' => array(
'class' => 'PhpMyAdmin\\SqlParser\\Components\\ExpressionArray',
'field' => 'tables',
- 'options' => ['parseField' => 'table'],
- ],
- 'BACKUP' => [
+ 'options' => array('parseField' => 'table'),
+ ),
+ 'BACKUP' => array(
'class' => 'PhpMyAdmin\\SqlParser\\Components\\ExpressionArray',
'field' => 'tables',
- 'options' => ['parseField' => 'table'],
- ],
- 'CALL' => [
+ 'options' => array('parseField' => 'table'),
+ ),
+ 'CALL' => array(
'class' => 'PhpMyAdmin\\SqlParser\\Components\\FunctionCall',
'field' => 'call',
- ],
- 'CHECK' => [
+ ),
+ 'CHECK' => array(
'class' => 'PhpMyAdmin\\SqlParser\\Components\\ExpressionArray',
'field' => 'tables',
- 'options' => ['parseField' => 'table'],
- ],
- 'CHECKSUM' => [
+ 'options' => array('parseField' => 'table'),
+ ),
+ 'CHECKSUM' => array(
'class' => 'PhpMyAdmin\\SqlParser\\Components\\ExpressionArray',
'field' => 'tables',
- 'options' => ['parseField' => 'table'],
- ],
- 'CROSS JOIN' => [
+ 'options' => array('parseField' => 'table'),
+ ),
+ 'CROSS JOIN' => array(
'class' => 'PhpMyAdmin\\SqlParser\\Components\\JoinKeyword',
'field' => 'join',
- ],
- 'DROP' => [
+ ),
+ 'DROP' => array(
'class' => 'PhpMyAdmin\\SqlParser\\Components\\ExpressionArray',
'field' => 'fields',
- 'options' => ['parseField' => 'table'],
- ],
- 'FORCE' => [
+ 'options' => array('parseField' => 'table'),
+ ),
+ 'FORCE' => array(
'class' => 'PhpMyAdmin\\SqlParser\\Components\\IndexHint',
'field' => 'index_hints',
- ],
- 'FROM' => [
+ ),
+ 'FROM' => array(
'class' => 'PhpMyAdmin\\SqlParser\\Components\\ExpressionArray',
'field' => 'from',
- 'options' => ['field' => 'table'],
- ],
- 'GROUP BY' => [
+ 'options' => array('field' => 'table'),
+ ),
+ 'GROUP BY' => array(
'class' => 'PhpMyAdmin\\SqlParser\\Components\\GroupKeyword',
'field' => 'group',
- ],
- 'HAVING' => [
+ ),
+ 'HAVING' => array(
'class' => 'PhpMyAdmin\\SqlParser\\Components\\Condition',
'field' => 'having',
- ],
- 'IGNORE' => [
+ ),
+ 'IGNORE' => array(
'class' => 'PhpMyAdmin\\SqlParser\\Components\\IndexHint',
'field' => 'index_hints',
- ],
- 'INTO' => [
+ ),
+ 'INTO' => array(
'class' => 'PhpMyAdmin\\SqlParser\\Components\\IntoKeyword',
'field' => 'into',
- ],
- 'JOIN' => [
+ ),
+ 'JOIN' => array(
'class' => 'PhpMyAdmin\\SqlParser\\Components\\JoinKeyword',
'field' => 'join',
- ],
- 'LEFT JOIN' => [
+ ),
+ 'LEFT JOIN' => array(
'class' => 'PhpMyAdmin\\SqlParser\\Components\\JoinKeyword',
'field' => 'join',
- ],
- 'LEFT OUTER JOIN' => [
+ ),
+ 'LEFT OUTER JOIN' => array(
'class' => 'PhpMyAdmin\\SqlParser\\Components\\JoinKeyword',
'field' => 'join',
- ],
- 'ON' => [
+ ),
+ 'ON' => array(
'class' => 'PhpMyAdmin\\SqlParser\\Components\\Expression',
'field' => 'table',
- 'options' => ['parseField' => 'table'],
- ],
- 'RIGHT JOIN' => [
+ 'options' => array('parseField' => 'table'),
+ ),
+ 'RIGHT JOIN' => array(
'class' => 'PhpMyAdmin\\SqlParser\\Components\\JoinKeyword',
'field' => 'join',
- ],
- 'RIGHT OUTER JOIN' => [
+ ),
+ 'RIGHT OUTER JOIN' => array(
'class' => 'PhpMyAdmin\\SqlParser\\Components\\JoinKeyword',
'field' => 'join',
- ],
- 'INNER JOIN' => [
+ ),
+ 'INNER JOIN' => array(
'class' => 'PhpMyAdmin\\SqlParser\\Components\\JoinKeyword',
'field' => 'join',
- ],
- 'FULL JOIN' => [
+ ),
+ 'FULL JOIN' => array(
'class' => 'PhpMyAdmin\\SqlParser\\Components\\JoinKeyword',
'field' => 'join',
- ],
- 'FULL OUTER JOIN' => [
+ ),
+ 'FULL OUTER JOIN' => array(
'class' => 'PhpMyAdmin\\SqlParser\\Components\\JoinKeyword',
'field' => 'join',
- ],
- 'NATURAL JOIN' => [
+ ),
+ 'NATURAL JOIN' => array(
'class' => 'PhpMyAdmin\\SqlParser\\Components\\JoinKeyword',
'field' => 'join',
- ],
- 'NATURAL LEFT JOIN' => [
+ ),
+ 'NATURAL LEFT JOIN' => array(
'class' => 'PhpMyAdmin\\SqlParser\\Components\\JoinKeyword',
'field' => 'join',
- ],
- 'NATURAL RIGHT JOIN' => [
+ ),
+ 'NATURAL RIGHT JOIN' => array(
'class' => 'PhpMyAdmin\\SqlParser\\Components\\JoinKeyword',
'field' => 'join',
- ],
- 'NATURAL LEFT OUTER JOIN' => [
+ ),
+ 'NATURAL LEFT OUTER JOIN' => array(
'class' => 'PhpMyAdmin\\SqlParser\\Components\\JoinKeyword',
'field' => 'join',
- ],
- 'NATURAL RIGHT OUTER JOIN' => [
+ ),
+ 'NATURAL RIGHT OUTER JOIN' => array(
'class' => 'PhpMyAdmin\\SqlParser\\Components\\JoinKeyword',
'field' => 'join',
- ],
- 'STRAIGHT_JOIN' => [
+ ),
+ 'STRAIGHT_JOIN' => array(
'class' => 'PhpMyAdmin\\SqlParser\\Components\\JoinKeyword',
'field' => 'join',
- ],
- 'LIMIT' => [
+ ),
+ 'LIMIT' => array(
'class' => 'PhpMyAdmin\\SqlParser\\Components\\Limit',
'field' => 'limit',
- ],
- 'OPTIMIZE' => [
+ ),
+ 'OPTIMIZE' => array(
'class' => 'PhpMyAdmin\\SqlParser\\Components\\ExpressionArray',
'field' => 'tables',
- 'options' => ['parseField' => 'table'],
- ],
- 'ORDER BY' => [
+ 'options' => array('parseField' => 'table'),
+ ),
+ 'ORDER BY' => array(
'class' => 'PhpMyAdmin\\SqlParser\\Components\\OrderKeyword',
'field' => 'order',
- ],
- 'PARTITION' => [
+ ),
+ 'PARTITION' => array(
'class' => 'PhpMyAdmin\\SqlParser\\Components\\ArrayObj',
'field' => 'partition',
- ],
- 'PROCEDURE' => [
+ ),
+ 'PROCEDURE' => array(
'class' => 'PhpMyAdmin\\SqlParser\\Components\\FunctionCall',
'field' => 'procedure',
- ],
- 'RENAME' => [
+ ),
+ 'RENAME' => array(
'class' => 'PhpMyAdmin\\SqlParser\\Components\\RenameOperation',
'field' => 'renames',
- ],
- 'REPAIR' => [
+ ),
+ 'REPAIR' => array(
'class' => 'PhpMyAdmin\\SqlParser\\Components\\ExpressionArray',
'field' => 'tables',
- 'options' => ['parseField' => 'table'],
- ],
- 'RESTORE' => [
+ 'options' => array('parseField' => 'table'),
+ ),
+ 'RESTORE' => array(
'class' => 'PhpMyAdmin\\SqlParser\\Components\\ExpressionArray',
'field' => 'tables',
- 'options' => ['parseField' => 'table'],
- ],
- 'SET' => [
+ 'options' => array('parseField' => 'table'),
+ ),
+ 'SET' => array(
'class' => 'PhpMyAdmin\\SqlParser\\Components\\SetOperation',
'field' => 'set',
- ],
- 'SELECT' => [
+ ),
+ 'SELECT' => array(
'class' => 'PhpMyAdmin\\SqlParser\\Components\\ExpressionArray',
'field' => 'expr',
- ],
- 'TRUNCATE' => [
+ ),
+ 'TRUNCATE' => array(
'class' => 'PhpMyAdmin\\SqlParser\\Components\\Expression',
'field' => 'table',
- 'options' => ['parseField' => 'table'],
- ],
- 'UPDATE' => [
+ 'options' => array('parseField' => 'table'),
+ ),
+ 'UPDATE' => array(
'class' => 'PhpMyAdmin\\SqlParser\\Components\\ExpressionArray',
'field' => 'tables',
- 'options' => ['parseField' => 'table'],
- ],
- 'USE' => [
+ 'options' => array('parseField' => 'table'),
+ ),
+ 'USE' => array(
'class' => 'PhpMyAdmin\\SqlParser\\Components\\IndexHint',
'field' => 'index_hints',
- ],
- 'VALUE' => [
+ ),
+ 'VALUE' => array(
'class' => 'PhpMyAdmin\\SqlParser\\Components\\Array2d',
'field' => 'values',
- ],
- 'VALUES' => [
+ ),
+ 'VALUES' => array(
'class' => 'PhpMyAdmin\\SqlParser\\Components\\Array2d',
'field' => 'values',
- ],
- 'WHERE' => [
+ ),
+ 'WHERE' => array(
'class' => 'PhpMyAdmin\\SqlParser\\Components\\Condition',
'field' => 'where',
- ],
- ];
+ )
+ );
/**
* The list of tokens that are parsed.
@@ -526,10 +526,10 @@ class Parser extends Core
*
* @var SelectStatement $lastStatement
*/
- $lastStatement->union[] = [
+ $lastStatement->union[] = array(
$unionType,
- $statement,
- ];
+ $statement
+ );
// if there are no no delimiting brackets, the `ORDER` and
// `LIMIT` keywords actually belong to the first statement.
diff --git a/src/Statements/AlterStatement.php b/src/Statements/AlterStatement.php
index 0991532..b0c002d 100644
--- a/src/Statements/AlterStatement.php
+++ b/src/Statements/AlterStatement.php
@@ -42,7 +42,7 @@ class AlterStatement extends Statement
*
* @var array
*/
- public static $OPTIONS = [
+ public static $OPTIONS = array(
'ONLINE' => 1,
'OFFLINE' => 1,
'IGNORE' => 2,
@@ -54,8 +54,8 @@ class AlterStatement extends Statement
'SERVER' => 3,
'TABLE' => 3,
'TABLESPACE' => 3,
- 'VIEW' => 3,
- ];
+ 'VIEW' => 3
+ );
/**
* @param Parser $parser the instance that requests parsing
@@ -75,10 +75,10 @@ class AlterStatement extends Statement
$this->table = Expression::parse(
$parser,
$list,
- [
+ array(
'parseField' => 'table',
- 'breakOnAlias' => true,
- ]
+ 'breakOnAlias' => true
+ )
);
++$list->idx; // Skipping field.
diff --git a/src/Statements/AnalyzeStatement.php b/src/Statements/AnalyzeStatement.php
index ebc7f70..4294ae1 100644
--- a/src/Statements/AnalyzeStatement.php
+++ b/src/Statements/AnalyzeStatement.php
@@ -12,8 +12,8 @@ use PhpMyAdmin\SqlParser\Statement;
/**
* `ANALYZE` statement.
*
- * ANALYZE [NO_WRITE_TO_BINLOG | LOCAL] TABLE
- * tbl_name [, tbl_name] ...
+ * ANALYZE array(NO_WRITE_TO_BINLOG | LOCAL] TABLE
+ * tbl_name array(, tbl_name] ...
*
* @category Statements
*
@@ -26,12 +26,12 @@ class AnalyzeStatement extends Statement
*
* @var array
*/
- public static $OPTIONS = [
+ public static $OPTIONS = array(
'TABLE' => 1,
'NO_WRITE_TO_BINLOG' => 2,
- 'LOCAL' => 3,
- ];
+ 'LOCAL' => 3
+ );
/**
* Analyzed tables.
diff --git a/src/Statements/BackupStatement.php b/src/Statements/BackupStatement.php
index 574dc9a..e6abefa 100644
--- a/src/Statements/BackupStatement.php
+++ b/src/Statements/BackupStatement.php
@@ -9,7 +9,7 @@ namespace PhpMyAdmin\SqlParser\Statements;
/**
* `BACKUP` statement.
*
- * BACKUP TABLE tbl_name [, tbl_name] ... TO '/path/to/backup/directory'
+ * BACKUP TABLE tbl_name array(, tbl_name] ... TO '/path/to/backup/directory'
*
* @category Statements
*
@@ -22,15 +22,15 @@ class BackupStatement extends MaintenanceStatement
*
* @var array
*/
- public static $OPTIONS = [
+ public static $OPTIONS = array(
'TABLE' => 1,
'NO_WRITE_TO_BINLOG' => 2,
'LOCAL' => 3,
- 'TO' => [
+ 'TO' => array(
4,
'var',
- ],
- ];
+ )
+ );
}
diff --git a/src/Statements/CheckStatement.php b/src/Statements/CheckStatement.php
index 789679f..cf72003 100644
--- a/src/Statements/CheckStatement.php
+++ b/src/Statements/CheckStatement.php
@@ -9,7 +9,7 @@ namespace PhpMyAdmin\SqlParser\Statements;
/**
* `CHECK` statement.
*
- * CHECK TABLE tbl_name [, tbl_name] ... [option] ...
+ * CHECK TABLE tbl_name array(, tbl_name] ... array(option] ...
*
* @category Statements
*
@@ -22,7 +22,7 @@ class CheckStatement extends MaintenanceStatement
*
* @var array
*/
- public static $OPTIONS = [
+ public static $OPTIONS = array(
'TABLE' => 1,
'FOR UPGRADE' => 2,
@@ -30,6 +30,6 @@ class CheckStatement extends MaintenanceStatement
'FAST' => 4,
'MEDIUM' => 5,
'EXTENDED' => 6,
- 'CHANGED' => 7,
- ];
+ 'CHANGED' => 7
+ );
}
diff --git a/src/Statements/ChecksumStatement.php b/src/Statements/ChecksumStatement.php
index 3214748..239168d 100644
--- a/src/Statements/ChecksumStatement.php
+++ b/src/Statements/ChecksumStatement.php
@@ -9,7 +9,7 @@ namespace PhpMyAdmin\SqlParser\Statements;
/**
* `CHECKSUM` statement.
*
- * CHECKSUM TABLE tbl_name [, tbl_name] ... [ QUICK | EXTENDED ]
+ * CHECKSUM TABLE tbl_name array(, tbl_name] ... array( QUICK | EXTENDED ]
*
* @category Statements
*
@@ -22,10 +22,10 @@ class ChecksumStatement extends MaintenanceStatement
*
* @var array
*/
- public static $OPTIONS = [
+ public static $OPTIONS = array(
'TABLE' => 1,
'QUICK' => 2,
- 'EXTENDED' => 3,
- ];
+ 'EXTENDED' => 3
+ );
}
diff --git a/src/Statements/CreateStatement.php b/src/Statements/CreateStatement.php
index 3d019ef..54a5e5f 100644
--- a/src/Statements/CreateStatement.php
+++ b/src/Statements/CreateStatement.php
@@ -32,25 +32,25 @@ class CreateStatement extends Statement
*
* @var array
*/
- public static $OPTIONS = [
+ public static $OPTIONS = array(
// CREATE TABLE
'TEMPORARY' => 1,
// CREATE VIEW
'OR REPLACE' => 2,
- 'ALGORITHM' => [
+ 'ALGORITHM' => array(
3,
'var=',
- ],
+ ),
// `DEFINER` is also used for `CREATE FUNCTION / PROCEDURE`
- 'DEFINER' => [
+ 'DEFINER' => array(
4,
'expr=',
- ],
- 'SQL SECURITY' => [
+ ),
+ 'SQL SECURITY' => array(
5,
'var',
- ],
+ ),
'DATABASE' => 6,
'EVENT' => 6,
@@ -68,159 +68,159 @@ class CreateStatement extends Statement
'VIEW' => 6,
// CREATE TABLE
- 'IF NOT EXISTS' => 7,
- ];
+ 'IF NOT EXISTS' => 7
+ );
/**
* All database options.
*
* @var array
*/
- public static $DB_OPTIONS = [
- 'CHARACTER SET' => [
+ public static $DB_OPTIONS = array(
+ 'CHARACTER SET' => array(
1,
'var=',
- ],
- 'CHARSET' => [
+ ),
+ 'CHARSET' => array(
1,
'var=',
- ],
- 'DEFAULT CHARACTER SET' => [
+ ),
+ 'DEFAULT CHARACTER SET' => array(
1,
'var=',
- ],
- 'DEFAULT CHARSET' => [
+ ),
+ 'DEFAULT CHARSET' => array(
1,
'var=',
- ],
- 'DEFAULT COLLATE' => [
+ ),
+ 'DEFAULT COLLATE' => array(
2,
'var=',
- ],
- 'COLLATE' => [
+ ),
+ 'COLLATE' => array(
2,
'var=',
- ],
- ];
+ )
+ );
/**
* All table options.
*
* @var array
*/
- public static $TABLE_OPTIONS = [
- 'ENGINE' => [
+ public static $TABLE_OPTIONS = array(
+ 'ENGINE' => array(
1,
'var=',
- ],
- 'AUTO_INCREMENT' => [
+ ),
+ 'AUTO_INCREMENT' => array(
2,
'var=',
- ],
- 'AVG_ROW_LENGTH' => [
+ ),
+ 'AVG_ROW_LENGTH' => array(
3,
'var',
- ],
- 'CHARACTER SET' => [
+ ),
+ 'CHARACTER SET' => array(
4,
'var=',
- ],
- 'CHARSET' => [
+ ),
+ 'CHARSET' => array(
4,
'var=',
- ],
- 'DEFAULT CHARACTER SET' => [
+ ),
+ 'DEFAULT CHARACTER SET' => array(
4,
'var=',
- ],
- 'DEFAULT CHARSET' => [
+ ),
+ 'DEFAULT CHARSET' => array(
4,
'var=',
- ],
- 'CHECKSUM' => [
+ ),
+ 'CHECKSUM' => array(
5,
'var',
- ],
- 'DEFAULT COLLATE' => [
+ ),
+ 'DEFAULT COLLATE' => array(
6,
'var=',
- ],
- 'COLLATE' => [
+ ),
+ 'COLLATE' => array(
6,
'var=',
- ],
- 'COMMENT' => [
+ ),
+ 'COMMENT' => array(
7,
'var=',
- ],
- 'CONNECTION' => [
+ ),
+ 'CONNECTION' => array(
8,
'var',
- ],
- 'DATA DIRECTORY' => [
+ ),
+ 'DATA DIRECTORY' => array(
9,
'var',
- ],
- 'DELAY_KEY_WRITE' => [
+ ),
+ 'DELAY_KEY_WRITE' => array(
10,
'var',
- ],
- 'INDEX DIRECTORY' => [
+ ),
+ 'INDEX DIRECTORY' => array(
11,
'var',
- ],
- 'INSERT_METHOD' => [
+ ),
+ 'INSERT_METHOD' => array(
12,
'var',
- ],
- 'KEY_BLOCK_SIZE' => [
+ ),
+ 'KEY_BLOCK_SIZE' => array(
13,
'var',
- ],
- 'MAX_ROWS' => [
+ ),
+ 'MAX_ROWS' => array(
14,
'var',
- ],
- 'MIN_ROWS' => [
+ ),
+ 'MIN_ROWS' => array(
15,
'var',
- ],
- 'PACK_KEYS' => [
+ ),
+ 'PACK_KEYS' => array(
16,
'var',
- ],
- 'PASSWORD' => [
+ ),
+ 'PASSWORD' => array(
17,
'var',
- ],
- 'ROW_FORMAT' => [
+ ),
+ 'ROW_FORMAT' => array(
18,
'var',
- ],
- 'TABLESPACE' => [
+ ),
+ 'TABLESPACE' => array(
19,
'var',
- ],
- 'STORAGE' => [
+ ),
+ 'STORAGE' => array(
20,
'var',
- ],
- 'UNION' => [
+ ),
+ 'UNION' => array(
21,
'var',
- ],
- ];
+ )
+ );
/**
* All function options.
*
* @var array
*/
- public static $FUNC_OPTIONS = [
- 'COMMENT' => [
+ public static $FUNC_OPTIONS = array(
+ 'COMMENT' => array(
1,
'var=',
- ],
+ ),
'LANGUAGE SQL' => 2,
'DETERMINISTIC' => 3,
'NOT DETERMINISTIC' => 3,
@@ -228,24 +228,24 @@ class CreateStatement extends Statement
'NO SQL' => 4,
'READS SQL DATA' => 4,
'MODIFIES SQL DATA' => 4,
- 'SQL SECURITY DEFINER' => [
+ 'SQL SECURITY DEFINER' => array(
5,
'var',
- ],
- ];
+ )
+ );
/**
* All trigger options.
*
* @var array
*/
- public static $TRIGGER_OPTIONS = [
+ public static $TRIGGER_OPTIONS = array(
'BEFORE' => 1,
'AFTER' => 1,
'INSERT' => 2,
'UPDATE' => 2,
- 'DELETE' => 2,
- ];
+ 'DELETE' => 2
+ );
/**
* The name of the entity that is created.
@@ -474,10 +474,10 @@ class CreateStatement extends Statement
$this->name = Expression::parse(
$parser,
$list,
- [
+ array(
'parseField' => 'table',
- 'breakOnAlias' => true,
- ]
+ 'breakOnAlias' => true
+ )
);
if (! isset($this->name) || ($this->name === '')) {
@@ -524,10 +524,10 @@ class CreateStatement extends Statement
$this->like = Expression::parse(
$parser,
$list,
- [
+ array(
'parseField' => 'table',
- 'breakOnAlias' => true,
- ]
+ 'breakOnAlias' => true
+ )
);
// The 'LIKE' keyword was found, but no table_name was found next to it
if (is_null($this->like)) {
@@ -637,9 +637,9 @@ class CreateStatement extends Statement
$this->partitions = ArrayObj::parse(
$parser,
$list,
- [
- 'type' => 'PhpMyAdmin\\SqlParser\\Components\\PartitionDefinition',
- ]
+ array(
+ 'type' => 'PhpMyAdmin\\SqlParser\\Components\\PartitionDefinition'
+ )
);
}
break;
@@ -714,10 +714,10 @@ class CreateStatement extends Statement
$this->table = Expression::parse(
$parser,
$list,
- [
+ array(
'parseField' => 'table',
- 'breakOnAlias' => true,
- ]
+ 'breakOnAlias' => true
+ )
);
++$list->idx;
diff --git a/src/Statements/DeleteStatement.php b/src/Statements/DeleteStatement.php
index b55d5f4..823266d 100644
--- a/src/Statements/DeleteStatement.php
+++ b/src/Statements/DeleteStatement.php
@@ -54,11 +54,11 @@ class DeleteStatement extends Statement
*
* @var array
*/
- public static $OPTIONS = [
+ public static $OPTIONS = array(
'LOW_PRIORITY' => 1,
'QUICK' => 2,
- 'IGNORE' => 3,
- ];
+ 'IGNORE' => 3
+ );
/**
* The clauses of this statement, in order.
@@ -67,41 +67,41 @@ class DeleteStatement extends Statement
*
* @var array
*/
- public static $CLAUSES = [
- 'DELETE' => [
+ public static $CLAUSES = array(
+ 'DELETE' => array(
'DELETE',
2,
- ],
+ ),
// Used for options.
- '_OPTIONS' => [
+ '_OPTIONS' => array(
'_OPTIONS',
1,
- ],
- 'FROM' => [
+ ),
+ 'FROM' => array(
'FROM',
3,
- ],
- 'PARTITION' => [
+ ),
+ 'PARTITION' => array(
'PARTITION',
3,
- ],
- 'USING' => [
+ ),
+ 'USING' => array(
'USING',
3,
- ],
- 'WHERE' => [
+ ),
+ 'WHERE' => array(
'WHERE',
3,
- ],
- 'ORDER BY' => [
+ ),
+ 'ORDER BY' => array(
'ORDER BY',
3,
- ],
- 'LIMIT' => [
+ ),
+ 'LIMIT' => array(
'LIMIT',
3,
- ],
- ];
+ )
+ );
/**
* Table(s) used as sources for this statement.
diff --git a/src/Statements/DropStatement.php b/src/Statements/DropStatement.php
index 453bed1..3fcedcb 100644
--- a/src/Statements/DropStatement.php
+++ b/src/Statements/DropStatement.php
@@ -23,7 +23,7 @@ class DropStatement extends Statement
*
* @var array
*/
- public static $OPTIONS = [
+ public static $OPTIONS = array(
'DATABASE' => 1,
'EVENT' => 1,
'FUNCTION' => 1,
@@ -38,8 +38,8 @@ class DropStatement extends Statement
'TRIGGER' => 1,
'TEMPORARY' => 2,
- 'IF EXISTS' => 3,
- ];
+ 'IF EXISTS' => 3
+ );
/**
* The clauses of this statement, in order.
@@ -48,26 +48,26 @@ class DropStatement extends Statement
*
* @var array
*/
- public static $CLAUSES = [
- 'DROP' => [
+ public static $CLAUSES = array(
+ 'DROP' => array(
'DROP',
2,
- ],
+ ),
// Used for options.
- '_OPTIONS' => [
+ '_OPTIONS' => array(
'_OPTIONS',
1,
- ],
+ ),
// Used for select expressions.
- 'DROP_' => [
+ 'DROP_' => array(
'DROP',
1,
- ],
- 'ON' => [
+ ),
+ 'ON' => array(
'ON',
3,
- ],
- ];
+ )
+ );
/**
* Dropped elements.
diff --git a/src/Statements/InsertStatement.php b/src/Statements/InsertStatement.php
index 265929d..6258903 100644
--- a/src/Statements/InsertStatement.php
+++ b/src/Statements/InsertStatement.php
@@ -60,12 +60,12 @@ class InsertStatement extends Statement
*
* @var array
*/
- public static $OPTIONS = [
+ public static $OPTIONS = array(
'LOW_PRIORITY' => 1,
'DELAYED' => 2,
'HIGH_PRIORITY' => 3,
- 'IGNORE' => 4,
- ];
+ 'IGNORE' => 4
+ );
/**
* Tables used as target for this statement.
diff --git a/src/Statements/LoadStatement.php b/src/Statements/LoadStatement.php
index c5186cf..96ea8ae 100644
--- a/src/Statements/LoadStatement.php
+++ b/src/Statements/LoadStatement.php
@@ -49,48 +49,48 @@ class LoadStatement extends Statement
*
* @var array
*/
- public static $OPTIONS = [
+ public static $OPTIONS = array(
'LOW_PRIORITY' => 1,
'CONCURRENT' => 1,
- 'LOCAL' => 2,
- ];
+ 'LOCAL' => 2
+ );
/**
* FIELDS/COLUMNS Options for `LOAD DATA...INFILE` statements.
*
* @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 `LOAD DATA...INFILE` 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',
- ],
- ];
+ )
+ );
/**
* File name being used to load data.
diff --git a/src/Statements/OptimizeStatement.php b/src/Statements/OptimizeStatement.php
index cd9be0c..64b1d1a 100644
--- a/src/Statements/OptimizeStatement.php
+++ b/src/Statements/OptimizeStatement.php
@@ -26,12 +26,12 @@ class OptimizeStatement extends Statement
*
* @var array
*/
- public static $OPTIONS = [
+ public static $OPTIONS = array(
'TABLE' => 1,
'NO_WRITE_TO_BINLOG' => 2,
- 'LOCAL' => 3,
- ];
+ 'LOCAL' => 3
+ );
/**
* Optimized tables.
diff --git a/src/Statements/PurgeStatement.php b/src/Statements/PurgeStatement.php
index 4dc385e..ccae64e 100644
--- a/src/Statements/PurgeStatement.php
+++ b/src/Statements/PurgeStatement.php
@@ -92,19 +92,19 @@ class PurgeStatement extends Statement
switch ($state) {
case 0:
// parse `{ BINARY | MASTER }`
- $this->log_type = self::parseExpectedKeyword($parser, $token, ['BINARY', 'MASTER']);
+ $this->log_type = self::parseExpectedKeyword($parser, $token, array('BINARY', 'MASTER'));
break;
case 1:
// parse `LOGS`
- self::parseExpectedKeyword($parser, $token, ['LOGS']);
+ self::parseExpectedKeyword($parser, $token, array('LOGS'));
break;
case 2:
// parse `{ TO | BEFORE }`
- $this->end_option = self::parseExpectedKeyword($parser, $token, ['TO', 'BEFORE']);
+ $this->end_option = self::parseExpectedKeyword($parser, $token, array('TO', 'BEFORE'));
break;
case 3:
// parse `expr`
- $this->end_expr = Expression::parse($parser, $list, []);
+ $this->end_expr = Expression::parse($parser, $list, array());
break;
default:
$parser->error('Unexpected token.', $token);
diff --git a/src/Statements/RepairStatement.php b/src/Statements/RepairStatement.php
index e17cdee..a14e514 100644
--- a/src/Statements/RepairStatement.php
+++ b/src/Statements/RepairStatement.php
@@ -24,7 +24,7 @@ class RepairStatement extends MaintenanceStatement
*
* @var array
*/
- public static $OPTIONS = [
+ public static $OPTIONS = array(
'TABLE' => 1,
'NO_WRITE_TO_BINLOG' => 2,
@@ -32,6 +32,6 @@ class RepairStatement extends MaintenanceStatement
'QUICK' => 4,
'EXTENDED' => 5,
- 'USE_FRM' => 6,
- ];
+ 'USE_FRM' => 6
+ );
}
diff --git a/src/Statements/ReplaceStatement.php b/src/Statements/ReplaceStatement.php
index 5bb5e12..296eef8 100644
--- a/src/Statements/ReplaceStatement.php
+++ b/src/Statements/ReplaceStatement.php
@@ -47,10 +47,10 @@ class ReplaceStatement extends Statement
*
* @var array
*/
- public static $OPTIONS = [
+ public static $OPTIONS = array(
'LOW_PRIORITY' => 1,
- 'DELAYED' => 1,
- ];
+ 'DELAYED' => 1
+ );
/**
* Tables used as target for this statement.
@@ -160,7 +160,7 @@ class ReplaceStatement extends Statement
$this->into = IntoKeyword::parse(
$parser,
$list,
- ['fromReplace' => true]
+ array('fromReplace' => true)
);
$state = 1;
diff --git a/src/Statements/RestoreStatement.php b/src/Statements/RestoreStatement.php
index 6d2a72e..28dd4c9 100644
--- a/src/Statements/RestoreStatement.php
+++ b/src/Statements/RestoreStatement.php
@@ -22,12 +22,12 @@ class RestoreStatement extends MaintenanceStatement
*
* @var array
*/
- public static $OPTIONS = [
+ public static $OPTIONS = array(
'TABLE' => 1,
- 'FROM' => [
+ 'FROM' => array(
2,
'var',
- ],
- ];
+ )
+ );
}
diff --git a/src/Statements/SelectStatement.php b/src/Statements/SelectStatement.php
index a206b54..1e8150f 100644
--- a/src/Statements/SelectStatement.php
+++ b/src/Statements/SelectStatement.php
@@ -33,10 +33,10 @@ use PhpMyAdmin\SqlParser\Statement;
* [PARTITION partition_list]
* [WHERE where_condition]
* [GROUP BY {col_name | expr | position}
- * [ASC | DESC], ... [WITH ROLLUP]]
+ * [ASC | DESC), ... [WITH ROLLUP]]
* [HAVING where_condition]
* [ORDER BY {col_name | expr | position}
- * [ASC | DESC], ...]
+ * [ASC | DESC), ...]
* [LIMIT {[offset,] row_count | row_count OFFSET offset}]
* [PROCEDURE procedure_name(argument_list)]
* [INTO OUTFILE 'file_name'
@@ -57,28 +57,28 @@ class SelectStatement extends Statement
*
* @var array
*/
- public static $OPTIONS = [
+ public static $OPTIONS = array(
'ALL' => 1,
'DISTINCT' => 1,
'DISTINCTROW' => 1,
'HIGH_PRIORITY' => 2,
- 'MAX_STATEMENT_TIME' => [
+ 'MAX_STATEMENT_TIME' => array(
3,
'var=',
- ],
+ ),
'STRAIGHT_JOIN' => 4,
'SQL_SMALL_RESULT' => 5,
'SQL_BIG_RESULT' => 6,
'SQL_BUFFER_RESULT' => 7,
'SQL_CACHE' => 8,
'SQL_NO_CACHE' => 8,
- 'SQL_CALC_FOUND_ROWS' => 9,
- ];
+ 'SQL_CALC_FOUND_ROWS' => 9
+ );
- public static $END_OPTIONS = [
+ public static $END_OPTIONS = array(
'FOR UPDATE' => 1,
- 'LOCK IN SHARE MODE' => 1,
- ];
+ 'LOCK IN SHARE MODE' => 1
+ );
/**
* The clauses of this statement, in order.
@@ -87,139 +87,139 @@ class SelectStatement extends Statement
*
* @var array
*/
- public static $CLAUSES = [
- 'SELECT' => [
+ public static $CLAUSES = array(
+ 'SELECT' => array(
'SELECT',
2,
- ],
+ ),
// Used for options.
- '_OPTIONS' => [
+ '_OPTIONS' => array(
'_OPTIONS',
1,
- ],
+ ),
// Used for selected expressions.
- '_SELECT' => [
+ '_SELECT' => array(
'SELECT',
1,
- ],
- 'INTO' => [
+ ),
+ 'INTO' => array(
'INTO',
3,
- ],
- 'FROM' => [
+ ),
+ 'FROM' => array(
'FROM',
3,
- ],
- 'FORCE' => [
+ ),
+ 'FORCE' => array(
'FORCE',
1,
- ],
- 'USE' => [
+ ),
+ 'USE' => array(
'USE',
1,
- ],
- 'IGNORE' => [
+ ),
+ 'IGNORE' => array(
'IGNORE',
3,
- ],
- 'PARTITION' => [
+ ),
+ 'PARTITION' => array(
'PARTITION',
3,
- ],
+ ),
- 'JOIN' => [
+ 'JOIN' => array(
'JOIN',
1,
- ],
- 'FULL JOIN' => [
+ ),
+ 'FULL JOIN' => array(
'FULL JOIN',
1,
- ],
- 'INNER JOIN' => [
+ ),
+ 'INNER JOIN' => array(
'INNER JOIN',
1,
- ],
- 'LEFT JOIN' => [
+ ),
+ 'LEFT JOIN' => array(
'LEFT JOIN',
1,
- ],
- 'LEFT OUTER JOIN' => [
+ ),
+ 'LEFT OUTER JOIN' => array(
'LEFT OUTER JOIN',
1,
- ],
- 'RIGHT JOIN' => [
+ ),
+ 'RIGHT JOIN' => array(
'RIGHT JOIN',
1,
- ],
- 'RIGHT OUTER JOIN' => [
+ ),
+ 'RIGHT OUTER JOIN' => array(
'RIGHT OUTER JOIN',
1,
- ],
- 'NATURAL JOIN' => [
+ ),
+ 'NATURAL JOIN' => array(
'NATURAL JOIN',
1,
- ],
- 'NATURAL LEFT JOIN' => [
+ ),
+ 'NATURAL LEFT JOIN' => array(
'NATURAL LEFT JOIN',
1,
- ],
- 'NATURAL RIGHT JOIN' => [
+ ),
+ 'NATURAL RIGHT JOIN' => array(
'NATURAL RIGHT JOIN',
1,
- ],
- 'NATURAL LEFT OUTER JOIN' => [
+ ),
+ 'NATURAL LEFT OUTER JOIN' => array(
'NATURAL LEFT OUTER JOIN',
1,
- ],
- 'NATURAL RIGHT OUTER JOIN' => [
+ ),
+ 'NATURAL RIGHT OUTER JOIN' => array(
'NATURAL RIGHT JOIN',
1,
- ],
+ ),
- 'WHERE' => [
+ 'WHERE' => array(
'WHERE',
3,
- ],
- 'GROUP BY' => [
+ ),
+ 'GROUP BY' => array(
'GROUP BY',
3,
- ],
- 'HAVING' => [
+ ),
+ 'HAVING' => array(
'HAVING',
3,
- ],
- 'ORDER BY' => [
+ ),
+ 'ORDER BY' => array(
'ORDER BY',
3,
- ],
- 'LIMIT' => [
+ ),
+ 'LIMIT' => array(
'LIMIT',
3,
- ],
- 'PROCEDURE' => [
+ ),
+ 'PROCEDURE' => array(
'PROCEDURE',
3,
- ],
- 'UNION' => [
+ ),
+ 'UNION' => array(
'UNION',
1,
- ],
- 'EXCEPT' => [
+ ),
+ 'EXCEPT' => array(
'EXCEPT',
1,
- ],
- 'INTERSECT' => [
+ ),
+ 'INTERSECT' => array(
'INTERSECT',
1,
- ],
- '_END_OPTIONS' => [
+ ),
+ '_END_OPTIONS' => array(
'_END_OPTIONS',
1,
- ],
+ ),
// These are available only when `UNION` is present.
// 'ORDER BY' => array('ORDER BY', 3),
- // 'LIMIT' => array('LIMIT', 3),
- ];
+ // 'LIMIT' => array('LIMIT', 3)
+ );
/**
* Expressions that are being selected by this statement.
@@ -334,14 +334,14 @@ class SelectStatement extends Statement
if (! empty($this->union)) {
$clauses = static::$CLAUSES;
unset($clauses['ORDER BY'], $clauses['LIMIT']);
- $clauses['ORDER BY'] = [
+ $clauses['ORDER BY'] = array(
'ORDER BY',
- 3,
- ];
- $clauses['LIMIT'] = [
+ 3
+ );
+ $clauses['LIMIT'] = array(
'LIMIT',
- 3,
- ];
+ 3
+ );
return $clauses;
}
diff --git a/src/Statements/SetStatement.php b/src/Statements/SetStatement.php
index cc1e487..a499045 100644
--- a/src/Statements/SetStatement.php
+++ b/src/Statements/SetStatement.php
@@ -26,48 +26,48 @@ class SetStatement extends Statement
*
* @var array
*/
- public static $CLAUSES = [
- 'SET' => [
+ public static $CLAUSES = array(
+ 'SET' => array(
'SET',
- 3,
- ],
- '_END_OPTIONS' => [
+ 3
+ ),
+ '_END_OPTIONS' => array(
'_END_OPTIONS',
- 1,
- ],
- ];
+ 1
+ )
+ );
/**
* Possible exceptions in SET statment.
*
* @var array
*/
- public static $OPTIONS = [
- 'CHARSET' => [
+ public static $OPTIONS = array(
+ 'CHARSET' => array(
3,
'var',
- ],
- 'CHARACTER SET' => [
+ ),
+ 'CHARACTER SET' => array(
3,
'var',
- ],
- 'NAMES' => [
+ ),
+ 'NAMES' => array(
3,
'var',
- ],
- 'PASSWORD' => [
+ ),
+ 'PASSWORD' => array(
3,
'expr',
- ],
- ];
+ )
+ );
- public static $END_OPTIONS = [
- 'COLLATE' => [
+ public static $END_OPTIONS = array(
+ 'COLLATE' => array(
1,
'var',
- ],
- 'DEFAULT' => 1,
- ];
+ ),
+ 'DEFAULT' => 1
+ );
/**
* Options used in current statement.
diff --git a/src/Statements/ShowStatement.php b/src/Statements/ShowStatement.php
index d332968..e2b0d58 100644
--- a/src/Statements/ShowStatement.php
+++ b/src/Statements/ShowStatement.php
@@ -20,7 +20,7 @@ class ShowStatement extends NotImplementedStatement
*
* @var array
*/
- public static $OPTIONS = [
+ public static $OPTIONS = array(
'CREATE' => 1,
'AUTHORS' => 2,
'BINARY' => 2,
@@ -61,6 +61,6 @@ class ShowStatement extends NotImplementedStatement
'TRIGGERS' => 2,
'VARIABLES' => 2,
'VIEW' => 2,
- 'WARNINGS' => 2,
- ];
+ 'WARNINGS' => 2
+ );
}
diff --git a/src/Statements/TransactionStatement.php b/src/Statements/TransactionStatement.php
index 7c07b5f..c61cd37 100644
--- a/src/Statements/TransactionStatement.php
+++ b/src/Statements/TransactionStatement.php
@@ -60,7 +60,7 @@ class TransactionStatement extends Statement
*
* @var array
*/
- public static $OPTIONS = [
+ public static $OPTIONS = array(
'START TRANSACTION' => 1,
'BEGIN' => 1,
'COMMIT' => 1,
@@ -70,8 +70,8 @@ class TransactionStatement extends Statement
'AND NO CHAIN' => 3,
'AND CHAIN' => 3,
'RELEASE' => 4,
- 'NO RELEASE' => 4,
- ];
+ 'NO RELEASE' => 4
+ );
/**
* @param Parser $parser the instance that requests parsing
diff --git a/src/Statements/TruncateStatement.php b/src/Statements/TruncateStatement.php
index 52f6347..7498f03 100644
--- a/src/Statements/TruncateStatement.php
+++ b/src/Statements/TruncateStatement.php
@@ -23,9 +23,9 @@ class TruncateStatement extends Statement
*
* @var array
*/
- public static $OPTIONS = [
- 'TABLE' => 1,
- ];
+ public static $OPTIONS = array(
+ 'TABLE' => 1
+ );
/**
* The name of the truncated table.
diff --git a/src/Statements/UpdateStatement.php b/src/Statements/UpdateStatement.php
index 8e6708f..722fbf5 100644
--- a/src/Statements/UpdateStatement.php
+++ b/src/Statements/UpdateStatement.php
@@ -39,10 +39,10 @@ class UpdateStatement extends Statement
*
* @var array
*/
- public static $OPTIONS = [
+ public static $OPTIONS = array(
'LOW_PRIORITY' => 1,
- 'IGNORE' => 2,
- ];
+ 'IGNORE' => 2
+ );
/**
* The clauses of this statement, in order.
@@ -51,38 +51,38 @@ class UpdateStatement extends Statement
*
* @var array
*/
- public static $CLAUSES = [
- 'UPDATE' => [
+ public static $CLAUSES = array(
+ 'UPDATE' => array(
'UPDATE',
2,
- ],
+ ),
// Used for options.
- '_OPTIONS' => [
+ '_OPTIONS' => array(
'_OPTIONS',
1,
- ],
+ ),
// Used for updated tables.
- '_UPDATE' => [
+ '_UPDATE' => array(
'UPDATE',
1,
- ],
- 'SET' => [
+ ),
+ 'SET' => array(
'SET',
3,
- ],
- 'WHERE' => [
+ ),
+ 'WHERE' => array(
'WHERE',
3,
- ],
- 'ORDER BY' => [
+ ),
+ 'ORDER BY' => array(
'ORDER BY',
3,
- ],
- 'LIMIT' => [
+ ),
+ 'LIMIT' => array(
'LIMIT',
3,
- ],
- ];
+ )
+ );
/**
* Tables used as sources for this statement.
diff --git a/src/Token.php b/src/Token.php
index fe43e8b..ad5011e 100644
--- a/src/Token.php
+++ b/src/Token.php
@@ -330,16 +330,16 @@ class Token
public function getInlineToken()
{
return str_replace(
- [
+ array(
"\r",
"\n",
"\t",
- ],
- [
+ ),
+ array(
'\r',
'\n',
'\t',
- ],
+ ),
$this->token
);
}
diff --git a/src/Utils/BufferedQuery.php b/src/Utils/BufferedQuery.php
index 02c55c1..5597dcf 100644
--- a/src/Utils/BufferedQuery.php
+++ b/src/Utils/BufferedQuery.php
@@ -89,7 +89,7 @@ class BufferedQuery
{
// Merges specified options with defaults.
$this->options = array_merge(
- [
+ array(
/*
* The starting delimiter.
*
@@ -111,7 +111,7 @@ class BufferedQuery
* @var bool
*/
'add_delimiter' => false,
- ],
+ ),
$options
);
diff --git a/src/Utils/CLI.php b/src/Utils/CLI.php
index 4881c5b..07afad1 100644
--- a/src/Utils/CLI.php
+++ b/src/Utils/CLI.php
@@ -42,11 +42,11 @@ class CLI
public function parseHighlight()
{
- $longopts = [
+ $longopts = array(
'help',
'query:',
- 'format:',
- ];
+ 'format:'
+ );
$params = $this->getopt(
'hq:f:',
$longopts
@@ -58,7 +58,7 @@ class CLI
if (! isset($params['f'])) {
$params['f'] = 'cli';
}
- if (! in_array($params['f'], ['html', 'cli', 'text'])) {
+ if (! in_array($params['f'], array('html', 'cli', 'text'))) {
echo "ERROR: Invalid value for format!\n";
return false;
@@ -86,7 +86,7 @@ class CLI
if (isset($params['q'])) {
echo Formatter::format(
$params['q'],
- ['type' => $params['f']]
+ array('type' => $params['f'])
);
echo "\n";
@@ -106,11 +106,11 @@ class CLI
public function parseLint()
{
- $longopts = [
+ $longopts = array(
'help',
'query:',
- 'context:',
- ];
+ 'context:'
+ );
$params = $this->getopt(
'hq:c:',
$longopts
@@ -166,10 +166,10 @@ class CLI
public function parseTokenize()
{
- $longopts = [
+ $longopts = array(
'help',
- 'query:',
- ];
+ 'query:'
+ );
$params = $this->getopt(
'hq:',
$longopts
diff --git a/src/Utils/Error.php b/src/Utils/Error.php
index 49d634c..1b1e65a 100644
--- a/src/Utils/Error.php
+++ b/src/Utils/Error.php
@@ -37,21 +37,21 @@ class Error
foreach ($objs as $obj) {
if ($obj instanceof Lexer) {
foreach ($obj->errors as $err) {
- $ret[] = [
+ $ret[] = array(
$err->getMessage(),
$err->getCode(),
$err->ch,
- $err->pos,
- ];
+ $err->pos
+ );
}
} elseif ($obj instanceof Parser) {
foreach ($obj->errors as $err) {
- $ret[] = [
+ $ret[] = array(
$err->getMessage(),
$err->getCode(),
$err->token->token,
- $err->token->position,
- ];
+ $err->token->position
+ );
}
}
}
diff --git a/src/Utils/Formatter.php b/src/Utils/Formatter.php
index 0867c48..ab92cbb 100644
--- a/src/Utils/Formatter.php
+++ b/src/Utils/Formatter.php
@@ -46,10 +46,10 @@ class Formatter
*
* @var array
*/
- public static $SHORT_CLAUSES = [
+ public static $SHORT_CLAUSES = array(
'CREATE' => true,
- 'INSERT' => true,
- ];
+ 'INSERT' => true
+ );
/**
* Clauses that must be inlined.
@@ -58,7 +58,7 @@ class Formatter
*
* @var array
*/
- public static $INLINE_CLAUSES = [
+ public static $INLINE_CLAUSES = array(
'CREATE' => true,
'INTO' => true,
'LIMIT' => true,
@@ -66,8 +66,8 @@ class Formatter
'PARTITION' => true,
'PROCEDURE' => true,
'SUBPARTITION BY' => true,
- 'VALUES' => true,
- ];
+ 'VALUES' => true
+ );
/**
* Constructor.
@@ -120,7 +120,7 @@ class Formatter
*/
protected function getDefaultOptions()
{
- return [
+ return array(
/*
* The format of the result.
*
@@ -170,8 +170,8 @@ class Formatter
*
* @var bool
*/
- 'indent_parts' => true,
- ];
+ 'indent_parts' => true
+ );
}
/**
@@ -182,78 +182,78 @@ class Formatter
*/
protected function getDefaultFormats()
{
- return [
- [
+ return array(
+ array(
'type' => Token::TYPE_KEYWORD,
'flags' => Token::FLAG_KEYWORD_RESERVED,
'html' => 'class="sql-reserved"',
'cli' => "\x1b[35m",
'function' => 'strtoupper',
- ],
- [
+ ),
+ array(
'type' => Token::TYPE_KEYWORD,
'flags' => 0,
'html' => 'class="sql-keyword"',
'cli' => "\x1b[95m",
'function' => 'strtoupper',
- ],
- [
+ ),
+ array(
'type' => Token::TYPE_COMMENT,
'flags' => 0,
'html' => 'class="sql-comment"',
'cli' => "\x1b[37m",
'function' => '',
- ],
- [
+ ),
+ array(
'type' => Token::TYPE_BOOL,
'flags' => 0,
'html' => 'class="sql-atom"',
'cli' => "\x1b[36m",
'function' => 'strtoupper',
- ],
- [
+ ),
+ array(
'type' => Token::TYPE_NUMBER,
'flags' => 0,
'html' => 'class="sql-number"',
'cli' => "\x1b[92m",
'function' => 'strtolower',
- ],
- [
+ ),
+ array(
'type' => Token::TYPE_STRING,
'flags' => 0,
'html' => 'class="sql-string"',
'cli' => "\x1b[91m",
'function' => '',
- ],
- [
+ ),
+ array(
'type' => Token::TYPE_SYMBOL,
'flags' => Token::FLAG_SYMBOL_PARAMETER,
'html' => 'class="sql-parameter"',
'cli' => "\x1b[31m",
'function' => '',
- ],
- [
+ ),
+ array(
'type' => Token::TYPE_SYMBOL,
'flags' => 0,
'html' => 'class="sql-variable"',
'cli' => "\x1b[36m",
'function' => '',
- ],
- ];
+ )
+ );
}
private static function mergeFormats(array $formats, array $newFormats)
{
$added = array();
- $integers = [
+ $integers = array(
'flags',
- 'type',
- ];
- $strings = [
+ 'type'
+ );
+ $strings = array(
'html',
'cli',
- 'function',
- ];
+ 'function'
+ );
/* Sanitize the array so that we do not have to care later */
foreach ($newFormats as $j => $new) {
@@ -437,7 +437,7 @@ class Formatter
// Inline JOINs
if (($prev->type === Token::TYPE_KEYWORD && isset(JoinKeyword::$JOINS[$prev->value]))
- || (in_array($curr->value, ['ON', 'USING'], true) && isset(JoinKeyword::$JOINS[$list->tokens[$list->idx - 2]->value]))
+ || (in_array($curr->value, array('ON', 'USING'), true) && isset(JoinKeyword::$JOINS[$list->tokens[$list->idx - 2]->value]))
|| isset($list->tokens[$list->idx - 4], JoinKeyword::$JOINS[$list->tokens[$list->idx - 4]->value])
|| isset($list->tokens[$list->idx - 6], JoinKeyword::$JOINS[$list->tokens[$list->idx - 6]->value])
) {
@@ -529,7 +529,7 @@ class Formatter
public function escapeConsole($string)
{
return str_replace(
- [
+ array(
"\x00",
"\x01",
"\x02",
@@ -562,8 +562,8 @@ class Formatter
"\x1D",
"\x1E",
"\x1F",
- ],
- [
+ ),
+ array(
'\x00',
'\x01',
'\x02',
@@ -596,7 +596,7 @@ class Formatter
'\x1D',
'\x1E',
'\x1F',
- ],
+ ),
$string
);
}
diff --git a/src/Utils/Misc.php b/src/Utils/Misc.php
index ad81c8b..0ce25d9 100644
--- a/src/Utils/Misc.php
+++ b/src/Utils/Misc.php
@@ -63,18 +63,18 @@ class Misc
$expr->database : $database;
if (! isset($retval[$thisDb])) {
- $retval[$thisDb] = [
+ $retval[$thisDb] = array(
'alias' => null,
- 'tables' => [],
- ];
+ 'tables' => array()
+ );
}
if (! isset($retval[$thisDb]['tables'][$expr->table])) {
- $retval[$thisDb]['tables'][$expr->table] = [
+ $retval[$thisDb]['tables'][$expr->table] = array(
'alias' => (isset($expr->alias) && ($expr->alias !== '')) ?
$expr->alias : null,
- 'columns' => [],
- ];
+ 'columns' => array()
+ );
}
if (! isset($tables[$thisDb])) {
diff --git a/src/Utils/Query.php b/src/Utils/Query.php
index 861e690..834e642 100644
--- a/src/Utils/Query.php
+++ b/src/Utils/Query.php
@@ -47,7 +47,7 @@ class Query
*
* @var array
*/
- public static $FUNCTIONS = [
+ public static $FUNCTIONS = array(
'SUM',
'AVG',
'STD',
@@ -55,10 +55,10 @@ class Query
'MIN',
'MAX',
'BIT_OR',
- 'BIT_AND',
- ];
+ 'BIT_AND'
+ );
- public static $ALLFLAGS = [
+ public static $ALLFLAGS = array(
/*
* select ... DISTINCT ...
*/
@@ -211,8 +211,8 @@ class Query
/*
* ... UNION ...
*/
- 'union' => false,
- ];
+ 'union' => false
+ );
/**
* Gets an array with flags select statement has.
@@ -300,7 +300,7 @@ class Query
*/
public static function getFlags($statement, $all = false)
{
- $flags = ['querytype' => false];
+ $flags = array('querytype' => false);
if ($all) {
$flags = self::$ALLFLAGS;
}
@@ -424,10 +424,10 @@ class Query
foreach ($statement->from as $expr) {
if (isset($expr->table, $expr->alias) && ($expr->table !== '') && ($expr->alias !== '')
) {
- $tableAliases[$expr->alias] = [
+ $tableAliases[$expr->alias] = array(
$expr->table,
- isset($expr->database) ? $expr->database : null,
- ];
+ isset($expr->database) ? $expr->database : null
+ );
}
}
@@ -439,11 +439,11 @@ class Query
if (isset($tableAliases[$expr->table])) {
$arr = $tableAliases[$expr->table];
} else {
- $arr = [
+ $arr = array(
$expr->table,
(isset($expr->database) && ($expr->database !== '')) ?
- $expr->database : null,
- ];
+ $expr->database : null
+ );
}
if (! in_array($arr, $ret['select_tables'])) {
$ret['select_tables'][] = $arr;
@@ -459,11 +459,11 @@ class Query
if (empty($ret['select_tables'])) {
foreach ($statement->from as $expr) {
if (isset($expr->table) && ($expr->table !== '')) {
- $arr = [
+ $arr = array(
$expr->table,
(isset($expr->database) && ($expr->database !== '')) ?
- $expr->database : null,
- ];
+ $expr->database : null
+ );
if (! in_array($arr, $ret['select_tables'])) {
$ret['select_tables'][] = $arr;
}
@@ -489,7 +489,7 @@ class Query
if (($statement instanceof InsertStatement)
|| ($statement instanceof ReplaceStatement)
) {
- $expressions = [$statement->into->dest];
+ $expressions = array($statement->into->dest);
} elseif ($statement instanceof UpdateStatement) {
$expressions = $statement->tables;
} elseif (($statement instanceof SelectStatement)
@@ -499,7 +499,7 @@ class Query
} elseif (($statement instanceof AlterStatement)
|| ($statement instanceof TruncateStatement)
) {
- $expressions = [$statement->table];
+ $expressions = array($statement->table);
} elseif ($statement instanceof DropStatement) {
if (! $statement->options->has('TABLE')) {
// No tables are dropped.
@@ -796,11 +796,11 @@ class Query
// No statement was found so we return the entire query as being the
// remaining part.
if (! $fullStatement) {
- return [
+ return array(
null,
$query,
- $delimiter,
- ];
+ $delimiter
+ );
}
// At least one query was found so we have to build the rest of the
@@ -810,11 +810,11 @@ class Query
$query .= $list->tokens[$list->idx]->token;
}
- return [
+ return array(
trim($statement),
$query,
- $delimiter,
- ];
+ $delimiter
+ );
}
/**
diff --git a/src/Utils/Routine.php b/src/Utils/Routine.php
index 1faa028..89ab153 100644
--- a/src/Utils/Routine.php
+++ b/src/Utils/Routine.php
@@ -36,13 +36,13 @@ class Routine
$type = DataType::parse(new Parser(), $lexer->list);
if ($type === null) {
- return [
+ return array(
'',
'',
'',
'',
- '',
- ];
+ ''
+ );
}
$options = array();
@@ -50,13 +50,13 @@ class Routine
$options[] = is_string($opt) ? $opt : $opt['value'];
}
- return [
+ return array(
'',
'',
$type->name,
implode(',', $type->parameters),
- implode(' ', $options),
- ];
+ implode(' ', $options)
+ );
}
/**
@@ -74,13 +74,13 @@ class Routine
$param = ParameterDefinition::parse(new Parser(), $lexer->list);
if (empty($param[0])) {
- return [
- '',
+ return array(
'',
'',
'',
'',
- ];
+ ''
+ );
}
$param = $param[0];
@@ -90,13 +90,13 @@ class Routine
$options[] = is_string($opt) ? $opt : $opt['value'];
}
- return [
+ return array(
empty($param->inOut) ? '' : $param->inOut,
$param->name,
$param->type->name,
implode(',', $param->type->parameters),
- implode(' ', $options),
- ];
+ implode(' ', $options)
+ );
}
/**
@@ -108,15 +108,15 @@ class Routine
*/
public static function getParameters($statement)
{
- $retval = [
+ $retval = array(
'num' => 0,
- 'dir' => [],
- 'name' => [],
- 'type' => [],
- 'length' => [],
- 'length_arr' => [],
- 'opts' => [],
- ];
+ 'dir' => array(),
+ 'name' => array(),
+ 'type' => array(),
+ 'length' => array(),
+ 'length_arr' => array(),
+ 'opts' => array()
+ );
if (! empty($statement->parameters)) {
$idx = 0;
diff --git a/src/Utils/Table.php b/src/Utils/Table.php
index 5f706a0..ad87b75 100644
--- a/src/Utils/Table.php
+++ b/src/Utils/Table.php
@@ -45,10 +45,10 @@ class Table
$columns[] = $column['name'];
}
- $tmp = [
+ $tmp = array(
'constraint' => $field->name,
- 'index_list' => $columns,
- ];
+ 'index_list' => $columns
+ );
if (! empty($field->references)) {
$tmp['ref_db_name'] = $field->references->table->database;
@@ -98,10 +98,10 @@ class Table
continue;
}
- $ret[$field->name] = [
+ $ret[$field->name] = array(
'type' => $field->type->name,
- 'timestamp_not_null' => false,
- ];
+ 'timestamp_not_null' => false
+ );
if ($field->options) {
if ($field->type->name === 'TIMESTAMP') {
diff --git a/tests/Builder/CreateStatementTest.php b/tests/Builder/CreateStatementTest.php
index b2fefb2..9f1e0a6 100644
--- a/tests/Builder/CreateStatementTest.php
+++ b/tests/Builder/CreateStatementTest.php
@@ -101,18 +101,18 @@ class CreateStatementTest extends TestCase
$stmt->name = new Expression('', 'test', '');
$stmt->options = new OptionsArray(['TABLE']);
- $stmt->fields = [
+ $stmt->fields = array(
new CreateDefinition(
'id',
new OptionsArray(['NOT NULL', 'AUTO_INCREMENT']),
- new DataType('INT', [11], new OptionsArray(['UNSIGNED']))
+ new DataType('INT', array(11), new OptionsArray(['UNSIGNED']))
),
new CreateDefinition(
'',
null,
- new Key('', [['name' => 'id']], 'PRIMARY KEY')
- ),
- ];
+ new Key('', array(['name' => 'id']), 'PRIMARY KEY')
+ )
+ );
$this->assertEquals(
"CREATE TABLE `test` (\n" .
@@ -203,8 +203,8 @@ class CreateStatementTest extends TestCase
public function partitionQueries()
{
- return [
- [
+ return array(
+ array(
'subparts' => <<<EOT
CREATE TABLE `ts` (
`id` int(11) DEFAULT NULL,
@@ -227,9 +227,8 @@ SUBPARTITION s5 ENGINE=InnoDB
)
)
EOT
- ,
- ],
- [
+ ),
+ array(
'parts' => <<<EOT
CREATE TABLE ptest (
`event_date` date NOT NULL
@@ -243,9 +242,8 @@ PARTITION p3 ENGINE=InnoDB,
PARTITION p4 ENGINE=InnoDB
)
EOT
- ,
- ],
- ];
+ )
+ );
}
/**
diff --git a/tests/Builder/InsertStatementTest.php b/tests/Builder/InsertStatementTest.php
index cf46143..2152665 100644
--- a/tests/Builder/InsertStatementTest.php
+++ b/tests/Builder/InsertStatementTest.php
@@ -65,7 +65,7 @@ class InsertStatementTest extends TestCase
);
/* Assertion 6 */
- /* INSERT [OPTIONS] INTO ... */
+ /* INSERT array(OPTIONS] INTO ... */
$parser = new Parser(
'INSERT DELAYED IGNORE INTO tbl SELECT * FROM bar'
);
diff --git a/tests/Components/Array2dTest.php b/tests/Components/Array2dTest.php
index 1c57a43..5232330 100644
--- a/tests/Components/Array2dTest.php
+++ b/tests/Components/Array2dTest.php
@@ -14,10 +14,10 @@ class Array2dTest extends TestCase
$parser = new Parser();
$arrays = Array2d::parse($parser, $this->getTokensList('(1, 2) +'));
$this->assertEquals(
- [
+ array(
1,
2,
- ],
+ ),
$arrays[0]->values
);
}
diff --git a/tests/Components/ArrayObjTest.php b/tests/Components/ArrayObjTest.php
index 2df1276..dac9947 100644
--- a/tests/Components/ArrayObjTest.php
+++ b/tests/Components/ArrayObjTest.php
@@ -11,13 +11,13 @@ class ArrayObjTest extends TestCase
{
public function testBuildRaw()
{
- $component = new ArrayObj(['a', 'b'], []);
+ $component = new ArrayObj(array('a', 'b'), array());
$this->assertEquals('(a, b)', ArrayObj::build($component));
}
public function testBuildValues()
{
- $component = new ArrayObj([], ['a', 'b']);
+ $component = new ArrayObj(array(), array('a', 'b'));
$this->assertEquals('(a, b)', ArrayObj::build($component));
}
@@ -26,12 +26,12 @@ class ArrayObjTest extends TestCase
$components = ArrayObj::parse(
new Parser(),
$this->getTokensList('(1 + 2, 3 + 4)'),
- [
+ array(
'type' => 'PhpMyAdmin\\SqlParser\\Components\\Expression',
- 'typeOptions' => [
+ 'typeOptions' => array(
'breakOnParentheses' => true,
- ],
- ]
+ )
+ )
);
$this->assertEquals($components[0]->expr, '1 + 2');
$this->assertEquals($components[1]->expr, '3 + 4');
@@ -49,9 +49,9 @@ class ArrayObjTest extends TestCase
public function parseProvider()
{
- return [
- ['parser/parseArrayErr1'],
- ['parser/parseArrayErr3'],
- ];
+ return array(
+ array('parser/parseArrayErr1'),
+ array('parser/parseArrayErr3')
+ );
}
}
diff --git a/tests/Components/ExpressionArrayTest.php b/tests/Components/ExpressionArrayTest.php
index 597d0a3..9c7bd72 100644
--- a/tests/Components/ExpressionArrayTest.php
+++ b/tests/Components/ExpressionArrayTest.php
@@ -14,11 +14,11 @@ class ExpressionArrayTest extends TestCase
$component = ExpressionArray::parse(
new Parser(),
$this->getTokensList('(expr)'),
- [
- 'breakOnParentheses' => true,
- ]
+ array(
+ 'breakOnParentheses' => true
+ )
);
- $this->assertEquals([], $component);
+ $this->assertEquals(array(), $component);
}
public function testParse2()
@@ -26,9 +26,9 @@ class ExpressionArrayTest extends TestCase
$component = ExpressionArray::parse(
new Parser(),
$this->getTokensList('(expr) +'),
- [
- 'parenthesesDelimited' => true,
- ]
+ array(
+ 'parenthesesDelimited' => true
+ )
);
$this->assertCount(1, $component);
$this->assertEquals('(expr)', $component[0]->expr);
diff --git a/tests/Components/ExpressionTest.php b/tests/Components/ExpressionTest.php
index 914ca31..453755d 100644
--- a/tests/Components/ExpressionTest.php
+++ b/tests/Components/ExpressionTest.php
@@ -37,38 +37,38 @@ class ExpressionTest extends TestCase
public function parseErrProvider()
{
- return [
+ return array(
/*
array(
'(1))',
'Unexpected closing bracket.',
),
*/
- [
+ array(
'tbl..col',
'Unexpected dot.',
- ],
- [
+ ),
+ array(
'id AS AS id2',
'An alias was expected.',
- ],
- [
+ ),
+ array(
'id`id2`\'id3\'',
'An alias was previously found.',
- ],
- [
+ ),
+ array(
'(id) id2 id3',
'An alias was previously found.',
- ],
- ];
+ )
+ );
}
public function testBuild()
{
- $component = [
+ $component = array(
new Expression('1 + 2', 'three'),
- new Expression('1 + 3', 'four'),
- ];
+ new Expression('1 + 3', 'four')
+ );
$this->assertEquals(
Expression::build($component),
'1 + 2 AS `three`, 1 + 3 AS `four`'
diff --git a/tests/Components/FunctionCallTest.php b/tests/Components/FunctionCallTest.php
index 386b220..d9da50c 100644
--- a/tests/Components/FunctionCallTest.php
+++ b/tests/Components/FunctionCallTest.php
@@ -11,7 +11,7 @@ class FunctionCallTest extends TestCase
{
public function testBuildArray()
{
- $component = new FunctionCall('func', ['a', 'b']);
+ $component = new FunctionCall('func', array('a', 'b'));
$this->assertEquals('func(a, b)', FunctionCall::build($component));
}
diff --git a/tests/Components/GroupKeywordTest.php b/tests/Components/GroupKeywordTest.php
index 41ff89a..c31ed58 100644
--- a/tests/Components/GroupKeywordTest.php
+++ b/tests/Components/GroupKeywordTest.php
@@ -13,11 +13,11 @@ class GroupKeywordTest extends TestCase
{
$this->assertEquals(
GroupKeyword::build(
- [
+ array(
new GroupKeyword(new Expression('a')),
new GroupKeyword(new Expression('b')),
new GroupKeyword(new Expression('c')),
- ]
+ )
),
'a, b, c'
);
diff --git a/tests/Components/JoinKeywordTest.php b/tests/Components/JoinKeywordTest.php
index 91fd4a6..3eb2aab 100644
--- a/tests/Components/JoinKeywordTest.php
+++ b/tests/Components/JoinKeywordTest.php
@@ -24,7 +24,7 @@ class JoinKeywordTest extends TestCase
$this->assertCount(1, $component);
$this->assertEquals('table2', $component[0]->expr->expr);
$this->assertNull($component[0]->on);
- $this->assertEquals(['id'], $component[0]->using->values);
+ $this->assertEquals(array('id'), $component[0]->using->values);
}
public function testBuild()
diff --git a/tests/Components/LimitTest.php b/tests/Components/LimitTest.php
index b1b7943..5e544d7 100644
--- a/tests/Components/LimitTest.php
+++ b/tests/Components/LimitTest.php
@@ -32,9 +32,9 @@ class LimitTest extends TestCase
public function parseProvider()
{
- return [
- ['parser/parseLimitErr1'],
- ['parser/parseLimitErr2'],
- ];
+ return array(
+ array('parser/parseLimitErr1'),
+ array('parser/parseLimitErr2')
+ );
}
}
diff --git a/tests/Components/LockExpressionTest.php b/tests/Components/LockExpressionTest.php
index 003c887..348e38d 100644
--- a/tests/Components/LockExpressionTest.php
+++ b/tests/Components/LockExpressionTest.php
@@ -42,28 +42,28 @@ class LockExpressionTest extends TestCase
public function parseErrProvider()
{
- return [
- [
+ return array(
+ array(
'table1 AS t1',
'Unexpected end of LOCK expression.',
- ],
- [
+ ),
+ array(
'table1 AS t1 READ WRITE',
'Unexpected keyword.',
- ],
- [
+ ),
+ array(
'table1 AS t1 READ 2',
'Unexpected token.',
- ],
- ];
+ )
+ );
}
public function testBuild()
{
- $component = [
+ $component = array(
LockExpression::parse(new Parser(), $this->getTokensList('table1 AS t1 READ LOCAL')),
- LockExpression::parse(new Parser(), $this->getTokensList('table2 LOW_PRIORITY WRITE')),
- ];
+ LockExpression::parse(new Parser(), $this->getTokensList('table2 LOW_PRIORITY WRITE'))
+ );
$this->assertEquals(
LockExpression::build($component),
'table1 AS `t1` READ LOCAL, table2 LOW_PRIORITY WRITE'
diff --git a/tests/Components/OptionsArrayTest.php b/tests/Components/OptionsArrayTest.php
index 3904fdf..23a4e6b 100644
--- a/tests/Components/OptionsArrayTest.php
+++ b/tests/Components/OptionsArrayTest.php
@@ -14,26 +14,26 @@ class OptionsArrayTest extends TestCase
$component = OptionsArray::parse(
new Parser(),
$this->getTokensList('A B = /*comment*/ (test) C'),
- [
+ array(
'A' => 1,
- 'B' => [
+ 'B' => array(
2,
'var',
- ],
- 'C' => 3,
- ]
+ ),
+ 'C' => 3
+ )
);
$this->assertEquals(
- [
+ array(
1 => 'A',
- 2 => [
+ 2 => array(
'name' => 'B',
'expr' => '(test)',
'value' => 'test',
'equals' => true,
- ],
+ ),
3 => 'C',
- ],
+ ),
$component->options
);
}
@@ -43,17 +43,17 @@ class OptionsArrayTest extends TestCase
$component = OptionsArray::parse(
new Parser(),
$this->getTokensList('SUM = (3 + 5) RESULT = 8'),
- [
- 'SUM' => [
+ array(
+ 'SUM' => array(
1,
'expr',
- ['parenthesesDelimited' => true],
- ],
- 'RESULT' => [
+ array('parenthesesDelimited' => true),
+ ),
+ 'RESULT' => array(
2,
'var',
- ],
- ]
+ )
+ )
);
$this->assertEquals('(3 + 5)', (string) $component->has('SUM', true));
$this->assertEquals('8', $component->has('RESULT'));
@@ -64,14 +64,14 @@ class OptionsArrayTest extends TestCase
$component = OptionsArray::parse(
new Parser(),
$this->getTokensList('A B = /*comment*/ (test) C'),
- [
+ array(
'A' => 1,
- 'B' => [
+ 'B' => array(
2,
'var',
- ],
- 'C' => 3,
- ]
+ ),
+ 'C' => 3
+ )
);
$this->assertTrue($component->has('A'));
$this->assertEquals('test', $component->has('B'));
@@ -85,20 +85,20 @@ class OptionsArrayTest extends TestCase
$component = new OptionsArray(['a', 'b', 'c']);
$this->assertTrue($component->remove('b'));
$this->assertFalse($component->remove('d'));
- $this->assertEquals($component->options, [0 => 'a', 2 => 'c']);
+ $this->assertEquals($component->options, array(0 => 'a', 2 => 'c'));
/* Assertion 2 */
$component = OptionsArray::parse(
new Parser(),
$this->getTokensList('A B = /*comment*/ (test) C'),
- [
+ array(
'A' => 1,
- 'B' => [
+ 'B' => array(
2,
'var',
- ],
- 'C' => 3,
- ]
+ ),
+ 'C' => 3
+ )
);
$this->assertEquals('test', $component->has('B'));
$component->remove('B');
@@ -109,21 +109,21 @@ class OptionsArrayTest extends TestCase
{
$component = new OptionsArray(['a']);
$component->merge(['b', 'c']);
- $this->assertEquals($component->options, ['a', 'b', 'c']);
+ $this->assertEquals($component->options, array('a', 'b', 'c'));
}
public function testBuild()
{
$component = new OptionsArray(
- [
+ array(
'ALL',
'SQL_CALC_FOUND_ROWS',
- [
+ array(
'name' => 'MAX_STATEMENT_TIME',
'value' => '42',
'equals' => true,
- ],
- ]
+ ),
+ )
);
$this->assertEquals(
OptionsArray::build($component),
diff --git a/tests/Components/OrderKeywordTest.php b/tests/Components/OrderKeywordTest.php
index 11468fb..42c9b98 100644
--- a/tests/Components/OrderKeywordTest.php
+++ b/tests/Components/OrderKeywordTest.php
@@ -13,10 +13,10 @@ class OrderKeywordTest extends TestCase
{
$this->assertEquals(
OrderKeyword::build(
- [
+ array(
new OrderKeyword(new Expression('a'), 'ASC'),
- new OrderKeyword(new Expression('b'), 'DESC'),
- ]
+ new OrderKeyword(new Expression('b'), 'DESC')
+ )
),
'a ASC, b DESC'
);
diff --git a/tests/Components/ReferenceTest.php b/tests/Components/ReferenceTest.php
index 19768c7..898362a 100644
--- a/tests/Components/ReferenceTest.php
+++ b/tests/Components/ReferenceTest.php
@@ -14,12 +14,12 @@ class ReferenceTest extends TestCase
{
$component = Reference::parse(new Parser(), $this->getTokensList('tbl (id)'));
$this->assertEquals('tbl', $component->table->table);
- $this->assertEquals(['id'], $component->columns);
+ $this->assertEquals(array('id'), $component->columns);
}
public function testBuild()
{
- $component = new Reference(new Expression('`tbl`'), ['id']);
+ $component = new Reference(new Expression('`tbl`'), array('id'));
$this->assertEquals('`tbl` (`id`)', Reference::build($component));
}
}
diff --git a/tests/Lexer/ContextTest.php b/tests/Lexer/ContextTest.php
index 47bd10a..208e623 100644
--- a/tests/Lexer/ContextTest.php
+++ b/tests/Lexer/ContextTest.php
@@ -41,36 +41,36 @@ class ContextTest extends TestCase
public function contextLoading()
{
- return [
- 'MySQL match' => [
+ return array(
+ 'MySQL match' => array(
'MySql50500',
'MySql50500',
- ],
- 'MySQL strip' => [
+ ),
+ 'MySQL strip' => array(
'MySql50712',
'MySql50700',
- ],
- 'MySQL fallback' => [
+ ),
+ 'MySQL fallback' => array(
'MySql99999',
'MySql50700',
- ],
- 'MariaDB match' => [
+ ),
+ 'MariaDB match' => array(
'MariaDb100000',
'MariaDb100000',
- ],
- 'MariaDB stripg' => [
+ ),
+ 'MariaDB stripg' => array(
'MariaDb109900',
'MariaDb100000',
- ],
- 'MariaDB fallback' => [
+ ),
+ 'MariaDB fallback' => array(
'MariaDb990000',
'MariaDb100300',
- ],
- 'Invalid' => [
+ ),
+ 'Invalid' => array(
'Sql',
null,
- ],
- ];
+ )
+ );
}
/**
@@ -89,18 +89,18 @@ class ContextTest extends TestCase
public function contextNames()
{
- return [
- ['MySql50000'],
- ['MySql50100'],
- ['MySql50500'],
- ['MySql50600'],
- ['MySql50700'],
- ['MySql80000'],
- ['MariaDb100000'],
- ['MariaDb100100'],
- ['MariaDb100200'],
- ['MariaDb100300'],
- ];
+ return array(
+ array('MySql50000'),
+ array('MySql50100'),
+ array('MySql50500'),
+ array('MySql50600'),
+ array('MySql50700'),
+ array('MySql80000'),
+ array('MariaDb100000'),
+ array('MariaDb100100'),
+ array('MariaDb100200'),
+ array('MariaDb100300')
+ );
}
/**
@@ -140,10 +140,10 @@ class ContextTest extends TestCase
$this->assertEquals('`test`', Context::escape('test'));
$this->assertEquals(
- [
+ array(
'`a`',
'`b`',
- ],
+ ),
Context::escape(['a', 'b'])
);
}
diff --git a/tests/Lexer/LexerTest.php b/tests/Lexer/LexerTest.php
index aff2bc8..1bfcb8f 100644
--- a/tests/Lexer/LexerTest.php
+++ b/tests/Lexer/LexerTest.php
@@ -27,10 +27,10 @@ class LexerTest extends TestCase
$this->assertEquals(
$lexer->errors,
- [
+ array(
new LexerException('error #1', 'foo', 1, 2),
new LexerException('error #2', 'bar', 3, 4),
- ]
+ )
);
}
@@ -59,33 +59,33 @@ class LexerTest extends TestCase
public function lexProvider()
{
- return [
- ['lexer/lex'],
- ['lexer/lexUtf8'],
- ['lexer/lexBool'],
- ['lexer/lexComment'],
- ['lexer/lexCommentEnd'],
- ['lexer/lexDelimiter'],
- ['lexer/lexDelimiter2'],
- ['lexer/lexDelimiterErr1'],
- ['lexer/lexDelimiterErr2'],
- ['lexer/lexDelimiterErr3'],
- ['lexer/lexDelimiterLen'],
- ['lexer/lexKeyword'],
- ['lexer/lexKeyword2'],
- ['lexer/lexNumber'],
- ['lexer/lexOperator'],
- ['lexer/lexString'],
- ['lexer/lexStringErr1'],
- ['lexer/lexSymbol'],
- ['lexer/lexSymbolErr1'],
- ['lexer/lexSymbolErr2'],
- ['lexer/lexSymbolErr3'],
- ['lexer/lexSymbolUser'],
- ['lexer/lexWhitespace'],
- ['lexer/lexLabel1'],
- ['lexer/lexLabel2'],
- ['lexer/lexNoLabel'],
- ];
+ return array(
+ array('lexer/lex'),
+ array('lexer/lexUtf8'),
+ array('lexer/lexBool'),
+ array('lexer/lexComment'),
+ array('lexer/lexCommentEnd'),
+ array('lexer/lexDelimiter'),
+ array('lexer/lexDelimiter2'),
+ array('lexer/lexDelimiterErr1'),
+ array('lexer/lexDelimiterErr2'),
+ array('lexer/lexDelimiterErr3'),
+ array('lexer/lexDelimiterLen'),
+ array('lexer/lexKeyword'),
+ array('lexer/lexKeyword2'),
+ array('lexer/lexNumber'),
+ array('lexer/lexOperator'),
+ array('lexer/lexString'),
+ array('lexer/lexStringErr1'),
+ array('lexer/lexSymbol'),
+ array('lexer/lexSymbolErr1'),
+ array('lexer/lexSymbolErr2'),
+ array('lexer/lexSymbolErr3'),
+ array('lexer/lexSymbolUser'),
+ array('lexer/lexWhitespace'),
+ array('lexer/lexLabel1'),
+ array('lexer/lexLabel2'),
+ array('lexer/lexNoLabel')
+ );
}
}
diff --git a/tests/Lexer/TokensListTest.php b/tests/Lexer/TokensListTest.php
index a03bfad..214f0cd 100644
--- a/tests/Lexer/TokensListTest.php
+++ b/tests/Lexer/TokensListTest.php
@@ -21,7 +21,7 @@ class TokensListTest extends TestCase
*/
public function setUp()
{
- $this->tokens = [
+ $this->tokens = array(
new Token('SELECT', Token::TYPE_KEYWORD),
new Token(' ', Token::TYPE_WHITESPACE),
new Token('*', Token::TYPE_OPERATOR),
@@ -29,8 +29,8 @@ class TokensListTest extends TestCase
new Token('FROM', Token::TYPE_KEYWORD),
new Token(' ', Token::TYPE_WHITESPACE),
new Token('`test`', Token::TYPE_SYMBOL),
- new Token(' ', Token::TYPE_WHITESPACE),
- ];
+ new Token(' ', Token::TYPE_WHITESPACE)
+ );
}
public function testBuild()
diff --git a/tests/Misc/BugsTest.php b/tests/Misc/BugsTest.php
index 3769b1f..67fd07d 100644
--- a/tests/Misc/BugsTest.php
+++ b/tests/Misc/BugsTest.php
@@ -19,15 +19,15 @@ class BugsTest extends TestCase
public function bugProvider()
{
- return [
- ['bugs/gh9'],
- ['bugs/gh14'],
- ['bugs/gh16'],
- ['bugs/pma11800'],
- ['bugs/pma11836'],
- ['bugs/pma11843'],
- ['bugs/pma11867'],
- ['bugs/pma11879'],
- ];
+ return array(
+ array('bugs/gh9'),
+ array('bugs/gh14'),
+ array('bugs/gh16'),
+ array('bugs/pma11800'),
+ array('bugs/pma11836'),
+ array('bugs/pma11843'),
+ array('bugs/pma11867'),
+ array('bugs/pma11879')
+ );
}
}
diff --git a/tests/Misc/ParameterTest.php b/tests/Misc/ParameterTest.php
index accd19e..146733e 100644
--- a/tests/Misc/ParameterTest.php
+++ b/tests/Misc/ParameterTest.php
@@ -19,8 +19,8 @@ class ParameterTest extends TestCase
public function parameterProvider()
{
- return [
- ['misc/parseParameter'],
- ];
+ return array(
+ array('misc/parseParameter')
+ );
}
}
diff --git a/tests/Misc/UtfStringTest.php b/tests/Misc/UtfStringTest.php
index d2c4dbf..a80a077 100644
--- a/tests/Misc/UtfStringTest.php
+++ b/tests/Misc/UtfStringTest.php
@@ -103,27 +103,27 @@ class UtfStringTest extends TestCase
public function utf8Strings()
{
- return [
- 'ascii' => [
+ return array(
+ 'ascii' => array(
'abcdefghijklmnopqrstuvwxyz',
'k',
'u',
- ],
- 'unicode' => [
+ ),
+ 'unicode' => array(
'áéíóúýěřťǔǐǒǎšďȟǰǩľžčǚň',
'ǐ',
'č',
- ],
- 'emoji' => [
+ ),
+ 'emoji' => array(
'😂😄😃😀😊😉😍😘😚😗😂👿😮😨😱😠😡😤😖😆😋👯',
'😂',
'😋',
- ],
- 'iso' => [
+ ),
+ 'iso' => array(
"P\xf8\xed\xb9ern\xec \xbelu\xbbou\xe8k\xfd k\xf3d \xfap\xecl \xef\xe1belsk\xe9 k\xf3dy",
null,
null,
- ],
- ];
+ )
+ );
}
}
diff --git a/tests/Parser/AlterStatementTest.php b/tests/Parser/AlterStatementTest.php
index d8df785..5748b13 100644
--- a/tests/Parser/AlterStatementTest.php
+++ b/tests/Parser/AlterStatementTest.php
@@ -19,17 +19,17 @@ class AlterStatementTest extends TestCase
public function alterProvider()
{
- return [
- ['parser/parseAlter'],
- ['parser/parseAlter2'],
- ['parser/parseAlter3'],
- ['parser/parseAlter4'],
- ['parser/parseAlter5'],
- ['parser/parseAlter6'],
- ['parser/parseAlter7'],
- ['parser/parseAlter8'],
- ['parser/parseAlterErr'],
- ['parser/parseAlterErr2'],
- ];
+ return array(
+ array('parser/parseAlter'),
+ array('parser/parseAlter2'),
+ array('parser/parseAlter3'),
+ array('parser/parseAlter4'),
+ array('parser/parseAlter5'),
+ array('parser/parseAlter6'),
+ array('parser/parseAlter7'),
+ array('parser/parseAlter8'),
+ array('parser/parseAlterErr'),
+ array('parser/parseAlterErr2')
+ );
}
}
diff --git a/tests/Parser/CallStatementTest.php b/tests/Parser/CallStatementTest.php
index 7ea75d9..a8501ef 100644
--- a/tests/Parser/CallStatementTest.php
+++ b/tests/Parser/CallStatementTest.php
@@ -19,10 +19,10 @@ class CallStatementTest extends TestCase
public function callProvider()
{
- return [
- ['parser/parseCall'],
- ['parser/parseCall2'],
- ['parser/parseCall3'],
- ];
+ return array(
+ array('parser/parseCall'),
+ array('parser/parseCall2'),
+ array('parser/parseCall3')
+ );
}
}
diff --git a/tests/Parser/CreateStatementTest.php b/tests/Parser/CreateStatementTest.php
index b44ab14..39344a9 100644
--- a/tests/Parser/CreateStatementTest.php
+++ b/tests/Parser/CreateStatementTest.php
@@ -19,36 +19,36 @@ class CreateStatementTest extends TestCase
public function createProvider()
{
- return [
- ['parser/parseCreateFunction'],
- ['parser/parseCreateFunctionErr1'],
- ['parser/parseCreateFunctionErr2'],
- ['parser/parseCreateFunctionErr3'],
- ['parser/parseCreateProcedure'],
- ['parser/parseCreateProcedure2'],
- ['parser/parseCreateTable'],
- ['parser/parseCreateTable2'],
- ['parser/parseCreateTable3'],
- ['parser/parseCreateTable4'],
- ['parser/parseCreateTable5'],
- ['parser/parseCreateTable6'],
- ['parser/parseCreateTable7'],
- ['parser/parseCreateTableErr1'],
- ['parser/parseCreateTableErr2'],
- ['parser/parseCreateTableErr3'],
- ['parser/parseCreateTableErr4'],
- ['parser/parseCreateTableErr5'],
- ['parser/parseCreateTableSelect'],
- ['parser/parseCreateTableAsSelect'],
- ['parser/parseCreateTableLike'],
- ['parser/parseCreateTableSpatial'],
- ['parser/parseCreateTableTimestampWithPrecision'],
- ['parser/parseCreateTrigger'],
- ['parser/parseCreateUser'],
- ['parser/parseCreateView'],
- ['parser/parseCreateView2'],
- ['parser/parseCreateViewWithoutQuotes'],
- ['parser/parseCreateViewWithQuotes'],
- ];
+ return array(
+ array('parser/parseCreateFunction'),
+ array('parser/parseCreateFunctionErr1'),
+ array('parser/parseCreateFunctionErr2'),
+ array('parser/parseCreateFunctionErr3'),
+ array('parser/parseCreateProcedure'),
+ array('parser/parseCreateProcedure2'),
+ array('parser/parseCreateTable'),
+ array('parser/parseCreateTable2'),
+ array('parser/parseCreateTable3'),
+ array('parser/parseCreateTable4'),
+ array('parser/parseCreateTable5'),
+ array('parser/parseCreateTable6'),
+ array('parser/parseCreateTable7'),
+ array('parser/parseCreateTableErr1'),
+ array('parser/parseCreateTableErr2'),
+ array('parser/parseCreateTableErr3'),
+ array('parser/parseCreateTableErr4'),
+ array('parser/parseCreateTableErr5'),
+ array('parser/parseCreateTableSelect'),
+ array('parser/parseCreateTableAsSelect'),
+ array('parser/parseCreateTableLike'),
+ array('parser/parseCreateTableSpatial'),
+ array('parser/parseCreateTableTimestampWithPrecision'),
+ array('parser/parseCreateTrigger'),
+ array('parser/parseCreateUser'),
+ array('parser/parseCreateView'),
+ array('parser/parseCreateView2'),
+ array('parser/parseCreateViewWithoutQuotes'),
+ array('parser/parseCreateViewWithQuotes')
+ );
}
}
diff --git a/tests/Parser/DeleteStatementTest.php b/tests/Parser/DeleteStatementTest.php
index 3c22fa7..7edbd4b 100644
--- a/tests/Parser/DeleteStatementTest.php
+++ b/tests/Parser/DeleteStatementTest.php
@@ -19,32 +19,32 @@ class DeleteStatementTest extends TestCase
public function deleteProvider()
{
- return [
- ['parser/parseDelete'],
- ['parser/parseDelete2'],
- ['parser/parseDelete3'],
- ['parser/parseDelete4'],
- ['parser/parseDelete5'],
- ['parser/parseDelete6'],
- ['parser/parseDelete7'],
- ['parser/parseDelete8'],
- ['parser/parseDelete9'],
- ['parser/parseDelete10'],
- ['parser/parseDelete11'],
- ['parser/parseDelete12'],
- ['parser/parseDeleteErr1'],
- ['parser/parseDeleteErr2'],
- ['parser/parseDeleteErr3'],
- ['parser/parseDeleteErr4'],
- ['parser/parseDeleteErr5'],
- ['parser/parseDeleteErr6'],
- ['parser/parseDeleteErr7'],
- ['parser/parseDeleteErr8'],
- ['parser/parseDeleteErr9'],
- ['parser/parseDeleteErr10'],
- ['parser/parseDeleteErr11'],
- ['parser/parseDeleteErr12'],
- ['parser/parseDeleteJoin'],
- ];
+ return array(
+ array('parser/parseDelete'),
+ array('parser/parseDelete2'),
+ array('parser/parseDelete3'),
+ array('parser/parseDelete4'),
+ array('parser/parseDelete5'),
+ array('parser/parseDelete6'),
+ array('parser/parseDelete7'),
+ array('parser/parseDelete8'),
+ array('parser/parseDelete9'),
+ array('parser/parseDelete10'),
+ array('parser/parseDelete11'),
+ array('parser/parseDelete12'),
+ array('parser/parseDeleteErr1'),
+ array('parser/parseDeleteErr2'),
+ array('parser/parseDeleteErr3'),
+ array('parser/parseDeleteErr4'),
+ array('parser/parseDeleteErr5'),
+ array('parser/parseDeleteErr6'),
+ array('parser/parseDeleteErr7'),
+ array('parser/parseDeleteErr8'),
+ array('parser/parseDeleteErr9'),
+ array('parser/parseDeleteErr10'),
+ array('parser/parseDeleteErr11'),
+ array('parser/parseDeleteErr12'),
+ array('parser/parseDeleteJoin')
+ );
}
}
diff --git a/tests/Parser/ExplainStatementTest.php b/tests/Parser/ExplainStatementTest.php
index a6a51af..dd3035e 100644
--- a/tests/Parser/ExplainStatementTest.php
+++ b/tests/Parser/ExplainStatementTest.php
@@ -19,8 +19,8 @@ class ExplainStatementTest extends TestCase
public function explainProvider()
{
- return [
- ['parser/parseExplain'],
- ];
+ return array(
+ array('parser/parseExplain')
+ );
}
}
diff --git a/tests/Parser/InsertStatementTest.php b/tests/Parser/InsertStatementTest.php
index cbc8fb9..0bea14c 100644
--- a/tests/Parser/InsertStatementTest.php
+++ b/tests/Parser/InsertStatementTest.php
@@ -19,16 +19,16 @@ class InsertStatementTest extends TestCase
public function insertProvider()
{
- return [
- ['parser/parseInsert'],
- ['parser/parseInsertSelect'],
- ['parser/parseInsertOnDuplicateKey'],
- ['parser/parseInsertSetOnDuplicateKey'],
- ['parser/parseInsertSelectOnDuplicateKey'],
- ['parser/parseInsertOnDuplicateKeyErr'],
- ['parser/parseInsertErr'],
- ['parser/parseInsertErr2'],
- ['parser/parseInsertIntoErr'],
- ];
+ return array(
+ array('parser/parseInsert'),
+ array('parser/parseInsertSelect'),
+ array('parser/parseInsertOnDuplicateKey'),
+ array('parser/parseInsertSetOnDuplicateKey'),
+ array('parser/parseInsertSelectOnDuplicateKey'),
+ array('parser/parseInsertOnDuplicateKeyErr'),
+ array('parser/parseInsertErr'),
+ array('parser/parseInsertErr2'),
+ array('parser/parseInsertIntoErr')
+ );
}
}
diff --git a/tests/Parser/LoadStatementTest.php b/tests/Parser/LoadStatementTest.php
index e56246d..40c6505 100644
--- a/tests/Parser/LoadStatementTest.php
+++ b/tests/Parser/LoadStatementTest.php
@@ -28,19 +28,19 @@ class LoadStatementTest extends TestCase
public function loadProvider()
{
- return [
- ['parser/parseLoad1'],
- ['parser/parseLoad2'],
- ['parser/parseLoad3'],
- ['parser/parseLoad4'],
- ['parser/parseLoad5'],
- ['parser/parseLoad6'],
- ['parser/parseLoadErr1'],
- ['parser/parseLoadErr2'],
- ['parser/parseLoadErr3'],
- ['parser/parseLoadErr4'],
- ['parser/parseLoadErr5'],
- ['parser/parseLoadErr6'],
- ];
+ return array(
+ array('parser/parseLoad1'),
+ array('parser/parseLoad2'),
+ array('parser/parseLoad3'),
+ array('parser/parseLoad4'),
+ array('parser/parseLoad5'),
+ array('parser/parseLoad6'),
+ array('parser/parseLoadErr1'),
+ array('parser/parseLoadErr2'),
+ array('parser/parseLoadErr3'),
+ array('parser/parseLoadErr4'),
+ array('parser/parseLoadErr5'),
+ array('parser/parseLoadErr6')
+ );
}
}
diff --git a/tests/Parser/LockStatementTest.php b/tests/Parser/LockStatementTest.php
index 54c18e8..c740768 100644
--- a/tests/Parser/LockStatementTest.php
+++ b/tests/Parser/LockStatementTest.php
@@ -19,24 +19,24 @@ class LockStatementTest extends TestCase
public function lockProvider()
{
- return [
- ['parser/parseLock1'],
- ['parser/parseLock2'],
- ['parser/parseLock3'],
- ['parser/parseLock4'],
- ['parser/parseLock5'],
- ['parser/parseLockErr1'],
- ['parser/parseLockErr2'],
- ['parser/parseLockErr3'],
- ['parser/parseLockErr4'],
- ['parser/parseLockErr5'],
- ['parser/parseLockErr6'],
- ['parser/parseLockErr7'],
- ['parser/parseLockErr8'],
- ['parser/parseLockErr9'],
- ['parser/parseLockErr10'],
- ['parser/parseUnlock1'],
- ['parser/parseUnlockErr1'],
- ];
+ return array(
+ array('parser/parseLock1'),
+ array('parser/parseLock2'),
+ array('parser/parseLock3'),
+ array('parser/parseLock4'),
+ array('parser/parseLock5'),
+ array('parser/parseLockErr1'),
+ array('parser/parseLockErr2'),
+ array('parser/parseLockErr3'),
+ array('parser/parseLockErr4'),
+ array('parser/parseLockErr5'),
+ array('parser/parseLockErr6'),
+ array('parser/parseLockErr7'),
+ array('parser/parseLockErr8'),
+ array('parser/parseLockErr9'),
+ array('parser/parseLockErr10'),
+ array('parser/parseUnlock1'),
+ array('parser/parseUnlockErr1')
+ );
}
}
diff --git a/tests/Parser/ParserTest.php b/tests/Parser/ParserTest.php
index 82afc18..f2344b5 100644
--- a/tests/Parser/ParserTest.php
+++ b/tests/Parser/ParserTest.php
@@ -23,11 +23,11 @@ class ParserTest extends TestCase
public function parseProvider()
{
- return [
- ['parser/parse'],
- ['parser/parse2'],
- ['parser/parseDelimiter'],
- ];
+ return array(
+ array('parser/parse'),
+ array('parser/parse2'),
+ array('parser/parseDelimiter')
+ );
}
public function testUnrecognizedStatement()
@@ -61,10 +61,10 @@ class ParserTest extends TestCase
$this->assertEquals(
$parser->errors,
- [
+ array(
new ParserException('error #1', new Token('foo'), 1),
new ParserException('error #2', new Token('bar'), 2),
- ]
+ )
);
}
diff --git a/tests/Parser/PurgeStatementTest.php b/tests/Parser/PurgeStatementTest.php
index 62ef923..6e898fa 100644
--- a/tests/Parser/PurgeStatementTest.php
+++ b/tests/Parser/PurgeStatementTest.php
@@ -19,14 +19,14 @@ class PurgeStatementTest extends TestCase
public function purgeProvider()
{
- return [
- ['parser/parsePurge'],
- ['parser/parsePurge2'],
- ['parser/parsePurge3'],
- ['parser/parsePurge4'],
- ['parser/parsePurgeErr'],
- ['parser/parsePurgeErr2'],
- ['parser/parsePurgeErr3'],
- ];
+ return array(
+ array('parser/parsePurge'),
+ array('parser/parsePurge2'),
+ array('parser/parsePurge3'),
+ array('parser/parsePurge4'),
+ array('parser/parsePurgeErr'),
+ array('parser/parsePurgeErr2'),
+ array('parser/parsePurgeErr3')
+ );
}
}
diff --git a/tests/Parser/RenameStatementTest.php b/tests/Parser/RenameStatementTest.php
index 6f8967c..9851daf 100644
--- a/tests/Parser/RenameStatementTest.php
+++ b/tests/Parser/RenameStatementTest.php
@@ -19,14 +19,14 @@ class RenameStatementTest extends TestCase
public function renameProvider()
{
- return [
- ['parser/parseRename'],
- ['parser/parseRename2'],
- ['parser/parseRenameErr1'],
- ['parser/parseRenameErr2'],
- ['parser/parseRenameErr3'],
- ['parser/parseRenameErr4'],
- ['parser/parseRenameErr5'],
- ];
+ return array(
+ array('parser/parseRename'),
+ array('parser/parseRename2'),
+ array('parser/parseRenameErr1'),
+ array('parser/parseRenameErr2'),
+ array('parser/parseRenameErr3'),
+ array('parser/parseRenameErr4'),
+ array('parser/parseRenameErr5')
+ );
}
}
diff --git a/tests/Parser/ReplaceStatementTest.php b/tests/Parser/ReplaceStatementTest.php
index 1850b17..a2495fe 100644
--- a/tests/Parser/ReplaceStatementTest.php
+++ b/tests/Parser/ReplaceStatementTest.php
@@ -19,16 +19,16 @@ class ReplaceStatementTest extends TestCase
public function replaceProvider()
{
- return [
- ['parser/parseReplace'],
- ['parser/parseReplace2'],
- ['parser/parseReplaceValues'],
- ['parser/parseReplaceSet'],
- ['parser/parseReplaceSelect'],
- ['parser/parseReplaceErr'],
- ['parser/parseReplaceErr2'],
- ['parser/parseReplaceErr3'],
- ['parser/parseReplaceIntoErr'],
- ];
+ return array(
+ array('parser/parseReplace'),
+ array('parser/parseReplace2'),
+ array('parser/parseReplaceValues'),
+ array('parser/parseReplaceSet'),
+ array('parser/parseReplaceSelect'),
+ array('parser/parseReplaceErr'),
+ array('parser/parseReplaceErr2'),
+ array('parser/parseReplaceErr3'),
+ array('parser/parseReplaceIntoErr')
+ );
}
}
diff --git a/tests/Parser/RestoreStatementTest.php b/tests/Parser/RestoreStatementTest.php
index 2d1aa73..b3af48e 100644
--- a/tests/Parser/RestoreStatementTest.php
+++ b/tests/Parser/RestoreStatementTest.php
@@ -19,8 +19,8 @@ class RestoreStatementTest extends TestCase
public function restoreProvider()
{
- return [
- ['parser/parseRestore'],
- ];
+ return array(
+ array('parser/parseRestore')
+ );
}
}
diff --git a/tests/Parser/SelectStatementTest.php b/tests/Parser/SelectStatementTest.php
index 91b8e82..d90ea41 100644
--- a/tests/Parser/SelectStatementTest.php
+++ b/tests/Parser/SelectStatementTest.php
@@ -28,64 +28,64 @@ class SelectStatementTest extends TestCase
public function selectProvider()
{
- return [
- ['parser/parseSelect2'],
- ['parser/parseSelect3'],
- ['parser/parseSelect4'],
- ['parser/parseSelect5'],
- ['parser/parseSelect6'],
- ['parser/parseSelect7'],
- ['parser/parseSelect8'],
- ['parser/parseSelect9'],
- ['parser/parseSelect10'],
- ['parser/parseSelect11'],
- ['parser/parseSelectErr1'],
- ['parser/parseSelectErr2'],
- ['parser/parseSelectNested'],
- ['parser/parseSelectCase1'],
- ['parser/parseSelectCase2'],
- ['parser/parseSelectCase3'],
- ['parser/parseSelectCase4'],
- ['parser/parseSelectCase5'],
- ['parser/parseSelectCaseErr1'],
- ['parser/parseSelectCaseErr2'],
- ['parser/parseSelectCaseErr3'],
- ['parser/parseSelectCaseErr4'],
- ['parser/parseSelectCaseErr5'],
- ['parser/parseSelectCaseAlias1'],
- ['parser/parseSelectCaseAlias2'],
- ['parser/parseSelectCaseAlias3'],
- ['parser/parseSelectCaseAlias4'],
- ['parser/parseSelectCaseAlias5'],
- ['parser/parseSelectCaseAlias6'],
- ['parser/parseSelectCaseAliasErr1'],
- ['parser/parseSelectCaseAliasErr2'],
- ['parser/parseSelectCaseAliasErr3'],
- ['parser/parseSelectCaseAliasErr4'],
- ['parser/parseSelectIntoOptions1'],
- ['parser/parseSelectIntoOptions2'],
- ['parser/parseSelectIntoOptions3'],
- ['parser/parseSelectJoinCross'],
- ['parser/parseSelectJoinNatural'],
- ['parser/parseSelectJoinNaturalLeft'],
- ['parser/parseSelectJoinNaturalRight'],
- ['parser/parseSelectJoinNaturalLeftOuter'],
- ['parser/parseSelectJoinNaturalRightOuter'],
- ['parser/parseSelectJoinMultiple'],
- ['parser/parseSelectJoinMultiple2'],
- ['parser/parseSelectWrongOrder'],
- ['parser/parseSelectWrongOrder2'],
- ['parser/parseSelectEndOptions1'],
- ['parser/parseSelectEndOptions2'],
- ['parser/parseSelectEndOptionsErr'],
- ['parser/parseSelectUnion'],
- ['parser/parseSelectUnion2'],
- ['parser/parseSelectIndexHint1'],
- ['parser/parseSelectIndexHint2'],
- ['parser/parseSelectIndexHintErr1'],
- ['parser/parseSelectIndexHintErr2'],
- ['parser/parseSelectIndexHintErr3'],
- ['parser/parseSelectIndexHintErr4'],
- ];
+ return array(
+ array('parser/parseSelect2'),
+ array('parser/parseSelect3'),
+ array('parser/parseSelect4'),
+ array('parser/parseSelect5'),
+ array('parser/parseSelect6'),
+ array('parser/parseSelect7'),
+ array('parser/parseSelect8'),
+ array('parser/parseSelect9'),
+ array('parser/parseSelect10'),
+ array('parser/parseSelect11'),
+ array('parser/parseSelectErr1'),
+ array('parser/parseSelectErr2'),
+ array('parser/parseSelectNested'),
+ array('parser/parseSelectCase1'),
+ array('parser/parseSelectCase2'),
+ array('parser/parseSelectCase3'),
+ array('parser/parseSelectCase4'),
+ array('parser/parseSelectCase5'),
+ array('parser/parseSelectCaseErr1'),
+ array('parser/parseSelectCaseErr2'),
+ array('parser/parseSelectCaseErr3'),
+ array('parser/parseSelectCaseErr4'),
+ array('parser/parseSelectCaseErr5'),
+ array('parser/parseSelectCaseAlias1'),
+ array('parser/parseSelectCaseAlias2'),
+ array('parser/parseSelectCaseAlias3'),
+ array('parser/parseSelectCaseAlias4'),
+ array('parser/parseSelectCaseAlias5'),
+ array('parser/parseSelectCaseAlias6'),
+ array('parser/parseSelectCaseAliasErr1'),
+ array('parser/parseSelectCaseAliasErr2'),
+ array('parser/parseSelectCaseAliasErr3'),
+ array('parser/parseSelectCaseAliasErr4'),
+ array('parser/parseSelectIntoOptions1'),
+ array('parser/parseSelectIntoOptions2'),
+ array('parser/parseSelectIntoOptions3'),
+ array('parser/parseSelectJoinCross'),
+ array('parser/parseSelectJoinNatural'),
+ array('parser/parseSelectJoinNaturalLeft'),
+ array('parser/parseSelectJoinNaturalRight'),
+ array('parser/parseSelectJoinNaturalLeftOuter'),
+ array('parser/parseSelectJoinNaturalRightOuter'),
+ array('parser/parseSelectJoinMultiple'),
+ array('parser/parseSelectJoinMultiple2'),
+ array('parser/parseSelectWrongOrder'),
+ array('parser/parseSelectWrongOrder2'),
+ array('parser/parseSelectEndOptions1'),
+ array('parser/parseSelectEndOptions2'),
+ array('parser/parseSelectEndOptionsErr'),
+ array('parser/parseSelectUnion'),
+ array('parser/parseSelectUnion2'),
+ array('parser/parseSelectIndexHint1'),
+ array('parser/parseSelectIndexHint2'),
+ array('parser/parseSelectIndexHintErr1'),
+ array('parser/parseSelectIndexHintErr2'),
+ array('parser/parseSelectIndexHintErr3'),
+ array('parser/parseSelectIndexHintErr4')
+ );
}
}
diff --git a/tests/Parser/SetStatementTest.php b/tests/Parser/SetStatementTest.php
index 4a5eea9..76fd30d 100644
--- a/tests/Parser/SetStatementTest.php
+++ b/tests/Parser/SetStatementTest.php
@@ -19,14 +19,14 @@ class SetStatementTest extends TestCase
public function setProvider()
{
- return [
- ['parser/parseSetCharset'],
- ['parser/parseSetCharsetError'],
- ['parser/parseSetCharacterSet'],
- ['parser/parseSetCharacterSetError'],
- ['parser/parseSetNames'],
- ['parser/parseSetNamesError'],
- ['parser/parseSetError1'],
- ];
+ return array(
+ array('parser/parseSetCharset'),
+ array('parser/parseSetCharsetError'),
+ array('parser/parseSetCharacterSet'),
+ array('parser/parseSetCharacterSetError'),
+ array('parser/parseSetNames'),
+ array('parser/parseSetNamesError'),
+ array('parser/parseSetError1')
+ );
}
}
diff --git a/tests/Parser/TransactionStatementTest.php b/tests/Parser/TransactionStatementTest.php
index 4e561f8..6f60b78 100644
--- a/tests/Parser/TransactionStatementTest.php
+++ b/tests/Parser/TransactionStatementTest.php
@@ -19,11 +19,11 @@ class TransactionStatementTest extends TestCase
public function transactionProvider()
{
- return [
- ['parser/parseTransaction'],
- ['parser/parseTransaction2'],
- ['parser/parseTransaction3'],
- ['parser/parseTransactionErr1'],
- ];
+ return array(
+ array('parser/parseTransaction'),
+ array('parser/parseTransaction2'),
+ array('parser/parseTransaction3'),
+ array('parser/parseTransactionErr1')
+ );
}
}
diff --git a/tests/Parser/UpdateStatementTest.php b/tests/Parser/UpdateStatementTest.php
index b0e5b01..4758fea 100644
--- a/tests/Parser/UpdateStatementTest.php
+++ b/tests/Parser/UpdateStatementTest.php
@@ -19,11 +19,11 @@ class UpdateStatementTest extends TestCase
public function updateProvider()
{
- return [
- ['parser/parseUpdate'],
- ['parser/parseUpdate2'],
- ['parser/parseUpdate3'],
- ['parser/parseUpdateErr'],
- ];
+ return array(
+ array('parser/parseUpdate'),
+ array('parser/parseUpdate2'),
+ array('parser/parseUpdate3'),
+ array('parser/parseUpdateErr')
+ );
}
}
diff --git a/tests/TestCase.php b/tests/TestCase.php
index f819118..ab3578f 100644
--- a/tests/TestCase.php
+++ b/tests/TestCase.php
@@ -48,17 +48,17 @@ abstract class TestCase extends BaseTestCase
$ret = array();
foreach ($obj->errors as $err) {
$ret[] = $obj instanceof Lexer
- ? [
+ ? array(
$err->getMessage(),
$err->ch,
$err->pos,
$err->getCode(),
- ]
- : [
+ )
+ : array(
$err->getMessage(),
$err->token,
- $err->getCode(),
- ];
+ $err->getCode()
+ );
}
return $ret;
diff --git a/tests/Utils/BufferedQueryTest.php b/tests/Utils/BufferedQueryTest.php
index ce22d4a..860c7a8 100644
--- a/tests/Utils/BufferedQueryTest.php
+++ b/tests/Utils/BufferedQueryTest.php
@@ -100,21 +100,21 @@ class BufferedQueryTest extends TestCase
'/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;' . "\n" .
'/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */';
- return [
- [
+ return array(
+ array(
"SELECT '\'';\nSELECT '\'';",
8,
- [
+ array(
'parse_delimiter' => true,
'add_delimiter' => true,
- ],
- [
+ ),
+ array(
"SELECT '\'';",
"SELECT '\'';",
- ],
- ],
+ ),
+ ),
- [
+ array(
"CREATE TABLE `test` (\n" .
" `txt` varchar(10)\n" .
");\n" .
@@ -122,58 +122,58 @@ class BufferedQueryTest extends TestCase
"INSERT INTO `test` (`txt`) VALUES('\\\\');\n" .
"INSERT INTO `test` (`txt`) VALUES('xyz');\n",
8,
- [
+ array(
'parse_delimiter' => true,
'add_delimiter' => true,
- ],
- [
+ ),
+ array(
"CREATE TABLE `test` (\n" .
" `txt` varchar(10)\n" .
');',
"INSERT INTO `test` (`txt`) VALUES('abc');",
"INSERT INTO `test` (`txt`) VALUES('\\\\');",
"INSERT INTO `test` (`txt`) VALUES('xyz');",
- ],
- ],
+ ),
+ ),
- [
+ array(
'SELECT """""""";' .
'SELECT """\\\\"""',
8,
- [
+ array(
'parse_delimiter' => true,
'add_delimiter' => true,
- ],
- [
+ ),
+ array(
'SELECT """""""";',
'SELECT """\\\\"""',
- ],
- ],
+ ),
+ ),
- [
+ array(
'DELIMITER A_VERY_LONG_DEL' . "\n" .
'SELECT 1 A_VERY_LONG_DEL' . "\n" .
'DELIMITER ;',
3,
- [
+ array(
'parse_delimiter' => true,
'add_delimiter' => true,
- ],
- [
+ ),
+ array(
'DELIMITER A_VERY_LONG_DEL',
'SELECT 1 A_VERY_LONG_DEL',
'DELIMITER ;',
- ],
- ],
+ ),
+ ),
- [
+ array(
$query,
32,
- [
+ array(
'parse_delimiter' => false,
'add_delimiter' => false,
- ],
- [
+ ),
+ array(
'/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */',
'/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */',
@@ -217,17 +217,17 @@ class BufferedQueryTest extends TestCase
'/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */',
'/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */',
- ],
- ],
+ ),
+ ),
- [
+ array(
$query,
32,
- [
+ array(
'parse_delimiter' => true,
'add_delimiter' => false,
- ],
- [
+ ),
+ array(
'/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */',
'/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */',
@@ -275,17 +275,17 @@ class BufferedQueryTest extends TestCase
'/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */',
'/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */',
- ],
- ],
+ ),
+ ),
- [
+ array(
$query,
64,
- [
+ array(
'parse_delimiter' => false,
'add_delimiter' => true,
- ],
- [
+ ),
+ array(
'/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;',
'/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;',
@@ -329,8 +329,8 @@ class BufferedQueryTest extends TestCase
'/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;',
'/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */',
- ],
- ],
- ];
+ ),
+ )
+ );
}
}
diff --git a/tests/Utils/CLITest.php b/tests/Utils/CLITest.php
index 0f3b9e6..e7df41d 100644
--- a/tests/Utils/CLITest.php
+++ b/tests/Utils/CLITest.php
@@ -24,8 +24,8 @@ class CLITest extends TestCase
{
$cli = new \PhpMyAdmin\SqlParser\Utils\CLI();
$this->assertEquals(
- $cli->getopt('', []),
- []
+ $cli->getopt('', array()),
+ array()
);
}
@@ -45,61 +45,61 @@ class CLITest extends TestCase
public function highlightParams()
{
- return [
- [
- ['q' => 'SELECT 1'],
+ return array(
+ array(
+ array('q' => 'SELECT 1'),
"\x1b[35mSELECT\n \x1b[92m1\x1b[0m\n",
0,
- ],
- [
- ['query' => 'SELECT 1'],
+ ),
+ array(
+ array('query' => 'SELECT 1'),
"\x1b[35mSELECT\n \x1b[92m1\x1b[0m\n",
0,
- ],
- [
- [
+ ),
+ array(
+ array(
'q' => 'SELECT /* comment */ 1 /* other */',
'f' => 'text',
- ],
+ ),
"SELECT\n /* comment */ 1 /* other */\n",
0,
- ],
- [
- [
+ ),
+ array(
+ array(
'q' => 'SELECT 1',
'f' => 'foo',
- ],
+ ),
"ERROR: Invalid value for format!\n",
1,
- ],
- [
- [
+ ),
+ array(
+ array(
'q' => 'SELECT 1',
'f' => 'html',
- ],
+ ),
'<span class="sql-reserved">SELECT</span>' . '<br/>' .
'&nbsp;&nbsp;&nbsp;&nbsp;<span class="sql-number">1</span>' . "\n",
0,
- ],
- [
- ['h' => true],
+ ),
+ array(
+ array('h' => true),
'Usage: highlight-query --query SQL [--format html|cli|text]' . "\n" .
' cat file.sql | highlight-query' . "\n",
0,
- ],
- [
- [],
+ ),
+ array(
+ array(),
'ERROR: Missing parameters!' . "\n" .
'Usage: highlight-query --query SQL [--format html|cli|text]' . "\n" .
' cat file.sql | highlight-query' . "\n",
1,
- ],
- [
+ ),
+ array(
false,
'',
1,
- ],
- ];
+ )
+ );
}
/**
@@ -118,43 +118,43 @@ class CLITest extends TestCase
public function lintParams()
{
- return [
- [
- ['q' => 'SELECT 1'],
+ return array(
+ array(
+ array('q' => 'SELECT 1'),
'',
0,
- ],
- [
- ['query' => 'SELECT 1'],
+ ),
+ array(
+ array('query' => 'SELECT 1'),
'',
0,
- ],
- [
- ['q' => 'SELECT SELECT'],
+ ),
+ array(
+ array('q' => 'SELECT SELECT'),
'#1: An expression was expected. (near "SELECT" at position 7)' . "\n" .
'#2: This type of clause was previously parsed. (near "SELECT" at position 7)' . "\n" .
'#3: An expression was expected. (near "" at position 0)' . "\n",
10,
- ],
- [
- ['h' => true],
+ ),
+ array(
+ array('h' => true),
'Usage: lint-query --query SQL' . "\n" .
' cat file.sql | lint-query' . "\n",
0,
- ],
- [
- [],
+ ),
+ array(
+ array(),
'ERROR: Missing parameters!' . "\n" .
'Usage: lint-query --query SQL' . "\n" .
' cat file.sql | lint-query' . "\n",
1,
- ],
- [
+ ),
+ array(
false,
'',
1,
- ],
- ];
+ )
+ );
}
/**
@@ -180,36 +180,36 @@ class CLITest extends TestCase
. "[TOKEN 3]\nType = 9\nFlags = 0\nValue = NULL\nToken = NULL\n\n"
);
- return [
- [
- ['q' => 'SELECT 1'],
+ return array(
+ array(
+ array('q' => 'SELECT 1'),
$result,
0,
- ],
- [
- ['query' => 'SELECT 1'],
+ ),
+ array(
+ array('query' => 'SELECT 1'),
$result,
0,
- ],
- [
- ['h' => true],
+ ),
+ array(
+ array('h' => true),
'Usage: tokenize-query --query SQL' . "\n" .
' cat file.sql | tokenize-query' . "\n",
0,
- ],
- [
- [],
+ ),
+ array(
+ array(),
'ERROR: Missing parameters!' . "\n" .
'Usage: tokenize-query --query SQL' . "\n" .
' cat file.sql | tokenize-query' . "\n",
1,
- ],
- [
+ ),
+ array(
false,
'',
1,
- ],
- ];
+ )
+ );
}
/**
@@ -228,13 +228,13 @@ class CLITest extends TestCase
{
$binPath = PHP_BINARY .' '. dirname(__DIR__,2 ). '/bin/';
- return [
- ['echo "SELECT 1" | '. $binPath .'highlight-query', 0],
- ['echo "invalid query" | '. $binPath .'highlight-query', 0],
- ['echo "SELECT 1" | '. $binPath .'lint-query', 0],
- ['echo "invalid query" | '. $binPath .'lint-query', 10],
- ['echo "SELECT 1" | '. $binPath .'tokenize-query', 0],
- ['echo "invalid query" | '. $binPath .'tokenize-query', 0],
- ];
+ return array(
+ array('echo "SELECT 1" | '. $binPath .'highlight-query', 0),
+ array('echo "invalid query" | '. $binPath .'highlight-query', 0),
+ array('echo "SELECT 1" | '. $binPath .'lint-query', 0),
+ array('echo "invalid query" | '. $binPath .'lint-query', 10),
+ array('echo "SELECT 1" | '. $binPath .'tokenize-query', 0),
+ array('echo "invalid query" | '. $binPath .'tokenize-query', 0)
+ );
}
}
diff --git a/tests/Utils/ErrorTest.php b/tests/Utils/ErrorTest.php
index 7e1326f..36dc198 100644
--- a/tests/Utils/ErrorTest.php
+++ b/tests/Utils/ErrorTest.php
@@ -15,20 +15,20 @@ class ErrorTest extends TestCase
$lexer = new Lexer('SELECT * FROM db..tbl $');
$parser = new Parser($lexer->list);
$this->assertEquals(
- [
- [
+ array(
+ array(
'Unexpected character.',
0,
'$',
22,
- ],
- [
+ ),
+ array(
'Unexpected dot.',
0,
'.',
17,
- ],
- ],
+ ),
+ ),
Error::get([$lexer, $parser])
);
}
@@ -36,7 +36,7 @@ class ErrorTest extends TestCase
public function testFormat()
{
$this->assertEquals(
- ['#1: error msg (near "token" at position 100)'],
+ array('#1: error msg (near "token" at position 100)'),
Error::format([['error msg', 42, 'token', 100]])
);
}
diff --git a/tests/Utils/FormatterTest.php b/tests/Utils/FormatterTest.php
index e758d9d..15532e5 100644
--- a/tests/Utils/FormatterTest.php
+++ b/tests/Utils/FormatterTest.php
@@ -24,32 +24,32 @@ class FormatterTest extends TestCase
$formatter->expects($this->once())
->method('getDefaultOptions')
- ->willReturn([
+ ->willReturn(array(
'type' => 'text',
'line_ending' => null,
'indentation' => null,
'clause_newline' => null,
- 'parts_newline' => null,
- ]);
+ 'parts_newline' => null
+ ));
$formatter->expects($this->once())
->method('getDefaultFormats')
->willReturn($default);
- $expectedOptions = [
+ $expectedOptions = array(
'type' => 'test-type',
'line_ending' => '<br>',
'indentation' => ' ',
'clause_newline' => null,
'parts_newline' => 0,
- 'formats' => $expected,
- ];
+ 'formats' => $expected
+ );
- $overridingOptions = [
+ $overridingOptions = array(
'type' => 'test-type',
'line_ending' => '<br>',
- 'formats' => $overriding,
- ];
+ 'formats' => $overriding
+ );
$reflectionMethod = new \ReflectionMethod($formatter, 'getMergedOptions');
$reflectionMethod->setAccessible(true);
@@ -58,179 +58,179 @@ class FormatterTest extends TestCase
public function mergeFormats()
{
- // array($default[], $overriding[], $expected[])
- return [
- 'empty formats' => [
- 'default' => [
- [
+ // array($default[), $overriding[), $expected[])
+ return array(
+ 'empty formats' => array(
+ 'default' => array(
+ array(
'type' => 0,
'flags' => 0,
'html' => '',
'cli' => '',
'function' => '',
- ],
- ],
- 'overriding' => [
- [],
- ],
- 'expected' => [
- [
+ ),
+ ),
+ 'overriding' => array(
+ array(),
+ ),
+ 'expected' => array(
+ array(
'type' => 0,
'flags' => 0,
'html' => '',
'cli' => '',
'function' => '',
- ],
- ],
- ],
- 'no flags' => [
- 'default' => [
- [
+ ),
+ ),
+ ),
+ 'no flags' => array(
+ 'default' => array(
+ array(
'type' => 0,
'flags' => 0,
'html' => 'html',
'cli' => 'cli',
- ],
- [
+ ),
+ array(
'type' => 0,
'flags' => 1,
'html' => 'html',
'cli' => 'cli',
- ],
- ],
- 'overriding' => [
- [
+ ),
+ ),
+ 'overriding' => array(
+ array(
'type' => 0,
'html' => 'new html',
'cli' => 'new cli',
- ],
- ],
- 'expected' => [
- [
+ ),
+ ),
+ 'expected' => array(
+ array(
'type' => 0,
'flags' => 0,
'html' => 'new html',
'cli' => 'new cli',
'function' => '',
- ],
- [
+ ),
+ array(
'type' => 0,
'flags' => 1,
'html' => 'html',
'cli' => 'cli',
- ],
- ],
- ],
- 'with flags' => [
- 'default' => [
- [
+ ),
+ ),
+ ),
+ 'with flags' => array(
+ 'default' => array(
+ array(
'type' => -1,
'flags' => 0,
'html' => 'html',
'cli' => 'cli',
- ],
- [
+ ),
+ array(
'type' => 0,
'flags' => 0,
'html' => 'html',
'cli' => 'cli',
- ],
- [
+ ),
+ array(
'type' => 0,
'flags' => 1,
'html' => 'html',
'cli' => 'cli',
- ],
- ],
- 'overriding' => [
- [
+ ),
+ ),
+ 'overriding' => array(
+ array(
'type' => 0,
'flags' => 0,
'html' => 'new html',
'cli' => 'new cli',
- ],
- ],
- 'expected' => [
- [
+ ),
+ ),
+ 'expected' => array(
+ array(
'type' => -1,
'flags' => 0,
'html' => 'html',
'cli' => 'cli',
- ],
- [
+ ),
+ array(
'type' => 0,
'flags' => 0,
'html' => 'new html',
'cli' => 'new cli',
'function' => '',
- ],
- [
+ ),
+ array(
'type' => 0,
'flags' => 1,
'html' => 'html',
'cli' => 'cli',
- ],
- ],
- ],
- 'with extra formats' => [
- 'default' => [
- [
+ ),
+ ),
+ ),
+ 'with extra formats' => array(
+ 'default' => array(
+ array(
'type' => 0,
'flags' => 0,
'html' => 'html',
'cli' => 'cli',
- ],
- ],
- 'overriding' => [
- [
+ ),
+ ),
+ 'overriding' => array(
+ array(
'type' => 0,
'flags' => 1,
'html' => 'new html',
'cli' => 'new cli',
- ],
- [
+ ),
+ array(
'type' => 1,
'html' => 'new html',
'cli' => 'new cli',
- ],
- [
+ ),
+ array(
'type' => 1,
'flags' => 1,
'html' => 'new html',
'cli' => 'new cli',
- ],
- ],
- 'expected' => [
- [
+ ),
+ ),
+ 'expected' => array(
+ array(
'type' => 0,
'flags' => 0,
'html' => 'html',
'cli' => 'cli',
- ],
- [
+ ),
+ array(
'type' => 0,
'flags' => 1,
'html' => 'new html',
'cli' => 'new cli',
'function' => '',
- ],
- [
+ ),
+ array(
'type' => 1,
'flags' => 0,
'html' => 'new html',
'cli' => 'new cli',
'function' => '',
- ],
- [
+ ),
+ array(
'type' => 1,
'flags' => 1,
'html' => 'new html',
'cli' => 'new cli',
'function' => '',
- ],
- ],
- ],
- ];
+ ),
+ ),
+ )
+ );
}
/**
@@ -244,25 +244,25 @@ class FormatterTest extends TestCase
public function testFormat($query, $text, $cli, $html, array $options = array())
{
// Test TEXT format
- $this->assertEquals($text, Formatter::format($query, ['type' => 'text'] + $options), 'Text formatting failed.');
+ $this->assertEquals($text, Formatter::format($query, array('type' => 'text') + $options), 'Text formatting failed.');
// Test CLI format
- $this->assertEquals($cli, Formatter::format($query, ['type' => 'cli'] + $options), 'CLI formatting failed.');
+ $this->assertEquals($cli, Formatter::format($query, array('type' => 'cli') + $options), 'CLI formatting failed.');
// Test HTML format
- $this->assertEquals($html, Formatter::format($query, ['type' => 'html'] + $options), 'HTML formatting failed.');
+ $this->assertEquals($html, Formatter::format($query, array('type' => 'html') + $options), 'HTML formatting failed.');
}
public function formatQueries()
{
- return [
- 'empty' => [
+ return array(
+ 'empty' => array(
'query' => '',
'text' => '',
'cli' => "\x1b[0m",
'html' => '',
- ],
- 'minimal' => [
+ ),
+ 'minimal' => array(
'query' => 'select 1',
'text' => 'SELECT' . "\n" .
' 1',
@@ -270,8 +270,8 @@ class FormatterTest extends TestCase
" \x1b[92m1" . "\x1b[0m",
'html' => '<span class="sql-reserved">SELECT</span>' . '<br/>' .
'&nbsp;&nbsp;&nbsp;&nbsp;<span class="sql-number">1</span>',
- ],
- 'simply' => [
+ ),
+ 'simply' => array(
'query' => 'select * from tbl where 1',
'text' => 'SELECT' . "\n" .
' *' . "\n" .
@@ -291,8 +291,8 @@ class FormatterTest extends TestCase
'&nbsp;&nbsp;&nbsp;&nbsp;tbl' . '<br/>' .
'<span class="sql-reserved">WHERE</span>' . '<br/>' .
'&nbsp;&nbsp;&nbsp;&nbsp;<span class="sql-number">1</span>',
- ],
- 'typical' => [
+ ),
+ 'typical' => array(
'query' => 'SELECT id, if(id=1,"Si","No") from `tbl` where id = 0 or id = 1 group by id order by id desc limit 1 offset 0',
'text' => 'SELECT' . "\n" .
' id,' . "\n" .
@@ -333,8 +333,8 @@ class FormatterTest extends TestCase
'&nbsp;&nbsp;&nbsp;&nbsp;id' . '<br/>' .
'<span class="sql-reserved">DESC</span>' . '<br/>' .
'<span class="sql-reserved">LIMIT</span> <span class="sql-number">1</span> <span class="sql-keyword">OFFSET</span> <span class="sql-number">0</span>',
- ],
- 'comments' => [
+ ),
+ 'comments' => array(
'query' => 'select /* Comment */ *' . "\n" .
'from tbl # Comment' . "\n" .
'where 1 -- Comment',
@@ -356,8 +356,8 @@ class FormatterTest extends TestCase
'&nbsp;&nbsp;&nbsp;&nbsp;tbl <span class="sql-comment"># Comment</span>' . '<br/>' .
'<span class="sql-reserved">WHERE</span>' . '<br/>' .
'&nbsp;&nbsp;&nbsp;&nbsp;<span class="sql-number">1</span> <span class="sql-comment">-- Comment</span>',
- ],
- 'strip comments' => [
+ ),
+ 'strip comments' => array(
'query' => 'select /* Comment */ *' . "\n" .
'from tbl # Comment' . "\n" .
'where 1 -- Comment',
@@ -379,11 +379,11 @@ class FormatterTest extends TestCase
'&nbsp;&nbsp;&nbsp;&nbsp;tbl' . '<br/>' .
'<span class="sql-reserved">WHERE</span>' . '<br/>' .
'&nbsp;&nbsp;&nbsp;&nbsp;<span class="sql-number">1</span>',
- 'options' => [
+ 'options' => array(
'remove_comments' => true,
- ],
- ],
- 'keywords' => [
+ ),
+ ),
+ 'keywords' => array(
'query' => 'select hex("1")',
'text' => 'SELECT' . "\n" .
' HEX("1")',
@@ -391,8 +391,8 @@ class FormatterTest extends TestCase
" \x1b[95mHEX\x1b[39m(\x1b[91m\"1\"\x1b[39m)" . "\x1b[0m",
'html' => '<span class="sql-reserved">SELECT</span>' . '<br/>' .
'&nbsp;&nbsp;&nbsp;&nbsp;<span class="sql-keyword">HEX</span>(<span class="sql-string">"1"</span>)',
- ],
- 'distinct count' => [
+ ),
+ 'distinct count' => array(
'query' => 'select distinct count(*)',
'text' => 'SELECT DISTINCT' . "\n" .
' COUNT(*)',
@@ -400,8 +400,8 @@ class FormatterTest extends TestCase
" \x1b[95mCOUNT\x1b[39m(*)" . "\x1b[0m",
'html' => '<span class="sql-reserved">SELECT</span> <span class="sql-reserved">DISTINCT</span>' . '<br/>' .
'&nbsp;&nbsp;&nbsp;&nbsp;<span class="sql-keyword">COUNT</span>(*)',
- ],
- 'create procedure' => [
+ ),
+ 'create procedure' => array(
'query' => 'create procedure test_procedure() begin from tbl select *; end',
'text' => 'CREATE PROCEDURE test_procedure()' . "\n" .
'BEGIN' . "\n" .
@@ -424,8 +424,8 @@ class FormatterTest extends TestCase
'&nbsp;&nbsp;&nbsp;&nbsp;<span class="sql-reserved">SELECT</span>' . '<br/>' .
'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*;' . '<br/>' .
'<span class="sql-keyword">END</span>',
- ],
- 'insert' => [
+ ),
+ 'insert' => array(
'query' => 'insert into foo values (0, 0, 0), (1, 1, 1)',
'text' => 'INSERT INTO foo' . "\n" .
'VALUES(0, 0, 0),(1, 1, 1)',
@@ -433,8 +433,8 @@ class FormatterTest extends TestCase
"\x1b[35mVALUES\x1b[39m(\x1b[92m0\x1b[39m, \x1b[92m0\x1b[39m, \x1b[92m0\x1b[39m),(\x1b[92m1\x1b[39m, \x1b[92m1\x1b[39m, \x1b[92m1\x1b[39m)" . "\x1b[0m",
'html' => '<span class="sql-reserved">INSERT</span> <span class="sql-reserved">INTO</span> foo' . '<br/>' .
'<span class="sql-reserved">VALUES</span>(<span class="sql-number">0</span>, <span class="sql-number">0</span>, <span class="sql-number">0</span>),(<span class="sql-number">1</span>, <span class="sql-number">1</span>, <span class="sql-number">1</span>)',
- ],
- 'string as alias' => [
+ ),
+ 'string as alias' => array(
'query' => 'select "Text" as bar',
'text' => 'SELECT' . "\n" .
' "Text" AS bar',
@@ -442,8 +442,8 @@ class FormatterTest extends TestCase
" \x1b[91m\"Text\" \x1b[35mAS \x1b[39mbar" . "\x1b[0m",
'html' => '<span class="sql-reserved">SELECT</span>' . '<br/>' .
'&nbsp;&nbsp;&nbsp;&nbsp;<span class="sql-string">"Text"</span> <span class="sql-reserved">AS</span> bar',
- ],
- 'escape cli' => [
+ ),
+ 'escape cli' => array(
'query' => "select 'text\x1b[33mcolor-inj'",
'text' => 'SELECT' . "\n" .
" 'text\x1B[33mcolor-inj'",
@@ -451,8 +451,8 @@ class FormatterTest extends TestCase
" \x1b[91m'text\\x1B[33mcolor-inj'" . "\x1b[0m",
'html' => '<span class="sql-reserved">SELECT</span>' . '<br/>' .
'&nbsp;&nbsp;&nbsp;&nbsp;<span class="sql-string">\'text' . "\x1b[33m" . 'color-inj\'</span>',
- ],
- 'escape html' => [
+ ),
+ 'escape html' => array(
'query' => "select '<s>xss' from `<s>xss` , <s>nxss /*s<s>xss*/",
'text' => 'SELECT' . "\n" .
' \'<s>xss\'' . "\n" .
@@ -468,8 +468,8 @@ class FormatterTest extends TestCase
'&nbsp;&nbsp;&nbsp;&nbsp;<span class="sql-string">\'&lt;s&gt;xss\'</span>' . '<br/>' .
'<span class="sql-reserved">FROM</span>' . '<br/>' .
'&nbsp;&nbsp;&nbsp;&nbsp;<span class="sql-variable">`&lt;s&gt;xss`</span>,<br/>&nbsp;&nbsp;&nbsp;&nbsp;&lt; s &gt; nxss <span class="sql-comment">/*s&lt;s&gt;xss*/</span>',
- ],
- 'create table' => [
+ ),
+ 'create table' => array(
'query' => 'create table if not exists `pma__bookmark` (' . "\n" .
'`id` int(11) not null auto_increment,' . "\n" .
'`dbase` varchar(255) not null default "",' . "\n" .
@@ -498,15 +498,15 @@ class FormatterTest extends TestCase
'&nbsp;&nbsp;&nbsp;&nbsp;<span class="sql-variable">`label`</span> <span class="sql-reserved">VARCHAR</span>(<span class="sql-number">255</span>) <span class="sql-reserved">COLLATE</span> utf8_general_ci <span class="sql-reserved">NOT NULL</span> <span class="sql-reserved">DEFAULT</span> <span class="sql-string">""</span>,' . '<br/>' .
'&nbsp;&nbsp;&nbsp;&nbsp;<span class="sql-variable">`query`</span> <span class="sql-keyword">TEXT</span> <span class="sql-reserved">NOT NULL</span>,' . '<br/>' .
'&nbsp;&nbsp;&nbsp;&nbsp;<span class="sql-reserved">PRIMARY KEY</span>(<span class="sql-variable">`id`</span>)',
- ],
- 'join' => [
+ ),
+ 'join' => array(
'query' => 'join tbl2 on c1=c2',
'text' => 'JOIN tbl2 ON c1 = c2',
'cli' => "\x1b[35mJOIN \x1b[39mtbl2 \x1b[35mON \x1b[39mc1 = c2" .
"\x1b[0m",
'html' => '<span class="sql-reserved">JOIN</span> tbl2 <span class="sql-reserved">ON</span> c1 = c2',
- ],
- 'named param' => [
+ ),
+ 'named param' => array(
'query' => 'select * from tbl where col = :param',
'text' => 'SELECT' . "\n" .
' *' . "\n" .
@@ -526,8 +526,8 @@ class FormatterTest extends TestCase
'&nbsp;&nbsp;&nbsp;&nbsp;tbl' . '<br/>' .
'<span class="sql-reserved">WHERE</span>' . '<br/>' .
'&nbsp;&nbsp;&nbsp;&nbsp;col = <span class="sql-parameter">:param</span>',
- ],
- 'anon param' => [
+ ),
+ 'anon param' => array(
'query' => 'select * from tbl where col = ?',
'text' => 'SELECT' . "\n" .
' *' . "\n" .
@@ -547,7 +547,7 @@ class FormatterTest extends TestCase
'&nbsp;&nbsp;&nbsp;&nbsp;tbl' . '<br/>' .
'<span class="sql-reserved">WHERE</span>' . '<br/>' .
'&nbsp;&nbsp;&nbsp;&nbsp;col = <span class="sql-parameter">?</span>',
- ],
- ];
+ )
+ );
}
}
diff --git a/tests/Utils/MiscTest.php b/tests/Utils/MiscTest.php
index dbd200e..01c1e10 100644
--- a/tests/Utils/MiscTest.php
+++ b/tests/Utils/MiscTest.php
@@ -25,104 +25,104 @@ class MiscTest extends TestCase
public function getAliasesProvider()
{
- return [
- [
+ return array(
+ array(
'select * from (select 1) tbl',
'mydb',
- [],
- ],
- [
+ array(),
+ ),
+ array(
'select i.name as `n`,abcdef gh from qwerty i',
'mydb',
- [
- 'mydb' => [
+ array(
+ 'mydb' => array(
'alias' => null,
- 'tables' => [
- 'qwerty' => [
+ 'tables' => array(
+ 'qwerty' => array(
'alias' => 'i',
- 'columns' => [
+ 'columns' => array(
'name' => 'n',
'abcdef' => 'gh',
- ],
- ],
- ],
- ],
- ],
- ],
- [
+ ),
+ ),
+ ),
+ ),
+ ),
+ ),
+ array(
'select film_id id,title from film',
'sakila',
- [
- 'sakila' => [
+ array(
+ 'sakila' => array(
'alias' => null,
- 'tables' => [
- 'film' => [
+ 'tables' => array(
+ 'film' => array(
'alias' => null,
- 'columns' => [
+ 'columns' => array(
'film_id' => 'id',
- ],
- ],
- ],
- ],
- ],
- ],
- [
+ ),
+ ),
+ ),
+ ),
+ ),
+ ),
+ array(
'select `sakila`.`A`.`actor_id` as aid,`F`.`film_id` `fid`,'
. 'last_update updated from `sakila`.actor A join `film_actor` as '
. '`F` on F.actor_id = A.`actor_id`',
'sakila',
- [
- 'sakila' => [
+ array(
+ 'sakila' => array(
'alias' => null,
- 'tables' => [
- 'film_actor' => [
+ 'tables' => array(
+ 'film_actor' => array(
'alias' => 'F',
- 'columns' => [
+ 'columns' => array(
'film_id' => 'fid',
'last_update' => 'updated',
- ],
- ],
- 'actor' => [
+ ),
+ ),
+ 'actor' => array(
'alias' => 'A',
- 'columns' => [
+ 'columns' => array(
'actor_id' => 'aid',
'last_update' => 'updated',
- ],
- ],
- ],
- ],
- ],
- ],
- [
+ ),
+ ),
+ ),
+ ),
+ ),
+ ),
+ array(
'SELECT film_id FROM (SELECT * FROM film) as f;',
'sakila',
- [],
- ],
- [
+ array(),
+ ),
+ array(
'',
null,
- [],
- ],
- [
+ array(),
+ ),
+ array(
'SELECT 1',
null,
- [],
- ],
- [
+ array(),
+ ),
+ array(
'SELECT * FROM orders AS ord WHERE 1',
'db',
- [
- 'db' => [
+ array(
+ 'db' => array(
'alias' => null,
- 'tables' => [
- 'orders' => [
+ 'tables' => array(
+ 'orders' => array(
'alias' => 'ord',
- 'columns' => [],
- ],
- ],
- ],
- ],
- ],
- ];
+ 'columns' => array(),
+ ),
+ ),
+ ),
+ ),
+ )
+ );
}
}
diff --git a/tests/Utils/QueryTest.php b/tests/Utils/QueryTest.php
index 5c0cc55..6c9bd97 100644
--- a/tests/Utils/QueryTest.php
+++ b/tests/Utils/QueryTest.php
@@ -26,257 +26,257 @@ class QueryTest extends TestCase
public function getFlagsProvider()
{
- return [
- [
+ return array(
+ array(
'ALTER TABLE DROP col',
- [
+ array(
'reload' => true,
'querytype' => 'ALTER',
- ],
- ],
- [
+ ),
+ ),
+ array(
'CALL test()',
- [
+ array(
'is_procedure' => true,
'querytype' => 'CALL',
- ],
- ],
- [
+ ),
+ ),
+ array(
'CREATE TABLE tbl (id INT)',
- [
+ array(
'reload' => true,
'querytype' => 'CREATE',
- ],
- ],
- [
+ ),
+ ),
+ array(
'CHECK TABLE tbl',
- [
+ array(
'is_maint' => true,
'querytype' => 'CHECK',
- ],
- ],
- [
+ ),
+ ),
+ array(
'DELETE FROM tbl',
- [
+ array(
'is_affected' => true,
'is_delete' => true,
'querytype' => 'DELETE',
- ],
- ],
- [
+ ),
+ ),
+ array(
'DROP VIEW v',
- [
+ array(
'reload' => true,
'querytype' => 'DROP',
- ],
- ],
- [
+ ),
+ ),
+ array(
'DROP DATABASE db',
- [
+ array(
'drop_database' => true,
'reload' => true,
'querytype' => 'DROP',
- ],
- ],
- [
+ ),
+ ),
+ array(
'EXPLAIN tbl',
- [
+ array(
'is_explain' => true,
'querytype' => 'EXPLAIN',
- ],
- ],
- [
+ ),
+ ),
+ array(
'LOAD DATA INFILE \'/tmp/test.txt\' INTO TABLE test',
- [
+ array(
'is_affected' => true,
'is_insert' => true,
'querytype' => 'LOAD',
- ],
- ],
- [
+ ),
+ ),
+ array(
'INSERT INTO tbl VALUES (1)',
- [
+ array(
'is_affected' => true,
'is_insert' => true,
'querytype' => 'INSERT',
- ],
- ],
- [
+ ),
+ ),
+ array(
'REPLACE INTO tbl VALUES (2)',
- [
+ array(
'is_affected' => true,
'is_replace' => true,
'is_insert' => true,
'querytype' => 'REPLACE',
- ],
- ],
- [
+ ),
+ ),
+ array(
'SELECT 1',
- [
+ array(
'is_select' => true,
'querytype' => 'SELECT',
- ],
- ],
- [
+ ),
+ ),
+ array(
'SELECT * FROM tbl',
- [
+ array(
'is_select' => true,
'select_from' => true,
'querytype' => 'SELECT',
- ],
- ],
- [
+ ),
+ ),
+ array(
'SELECT DISTINCT * FROM tbl LIMIT 0, 10 ORDER BY id',
- [
+ array(
'distinct' => true,
'is_select' => true,
'select_from' => true,
'limit' => true,
'order' => true,
'querytype' => 'SELECT',
- ],
- ],
- [
+ ),
+ ),
+ array(
'SELECT * FROM actor GROUP BY actor_id',
- [
+ array(
'is_group' => true,
'is_select' => true,
'select_from' => true,
'group' => true,
'querytype' => 'SELECT',
- ],
- ],
- [
+ ),
+ ),
+ array(
'SELECT col1, col2 FROM table1 PROCEDURE ANALYSE(10, 2000);',
- [
+ array(
'is_analyse' => true,
'is_select' => true,
'select_from' => true,
'querytype' => 'SELECT',
- ],
- ],
- [
+ ),
+ ),
+ array(
'SELECT * FROM tbl INTO OUTFILE "/tmp/export.txt"',
- [
+ array(
'is_export' => true,
'is_select' => true,
'select_from' => true,
'querytype' => 'SELECT',
- ],
- ],
- [
+ ),
+ ),
+ array(
'SELECT COUNT(id), SUM(id) FROM tbl',
- [
+ array(
'is_count' => true,
'is_func' => true,
'is_select' => true,
'select_from' => true,
'querytype' => 'SELECT',
- ],
- ],
- [
+ ),
+ ),
+ array(
'SELECT (SELECT "foo")',
- [
+ array(
'is_select' => true,
'is_subquery' => true,
'querytype' => 'SELECT',
- ],
- ],
- [
+ ),
+ ),
+ array(
'SELECT * FROM customer HAVING store_id = 2;',
- [
+ array(
'is_select' => true,
'select_from' => true,
'is_group' => true,
'having' => true,
'querytype' => 'SELECT',
- ],
- ],
- [
+ ),
+ ),
+ array(
'SELECT * FROM table1 INNER JOIN table2 ON table1.id=table2.id;',
- [
+ array(
'is_select' => true,
'select_from' => true,
'join' => true,
'querytype' => 'SELECT',
- ],
- ],
- [
+ ),
+ ),
+ array(
'SHOW CREATE TABLE tbl',
- [
+ array(
'is_show' => true,
'querytype' => 'SHOW',
- ],
- ],
- [
+ ),
+ ),
+ array(
'UPDATE tbl SET id = 1',
- [
+ array(
'is_affected' => true,
'querytype' => 'UPDATE',
- ],
- ],
- [
+ ),
+ ),
+ array(
'ANALYZE TABLE tbl',
- [
+ array(
'is_maint' => true,
'querytype' => 'ANALYZE',
- ],
- ],
- [
+ ),
+ ),
+ array(
'CHECKSUM TABLE tbl',
- [
+ array(
'is_maint' => true,
'querytype' => 'CHECKSUM',
- ],
- ],
- [
+ ),
+ ),
+ array(
'OPTIMIZE TABLE tbl',
- [
+ array(
'is_maint' => true,
'querytype' => 'OPTIMIZE',
- ],
- ],
- [
+ ),
+ ),
+ array(
'REPAIR TABLE tbl',
- [
+ array(
'is_maint' => true,
'querytype' => 'REPAIR',
- ],
- ],
- [
+ ),
+ ),
+ array(
'(SELECT a FROM t1 WHERE a=10 AND B=1 ORDER BY a LIMIT 10) ' .
'UNION ' .
'(SELECT a FROM t2 WHERE a=11 AND B=2 ORDER BY a LIMIT 10);',
- [
+ array(
'is_select' => true,
'select_from' => true,
'limit' => true,
'order' => true,
'union' => true,
'querytype' => 'SELECT',
- ],
- ],
- [
+ ),
+ ),
+ array(
'SELECT * FROM orders AS ord WHERE 1',
- [
+ array(
'querytype' => 'SELECT',
'is_select' => true,
'select_from' => true,
- ],
- ],
- [
+ ),
+ ),
+ array(
'SET NAMES \'latin\'',
- [
+ array(
'querytype' => 'SET',
- ],
- ],
- ];
+ ),
+ )
+ );
}
public function testGetAll()
{
$this->assertEquals(
- [
+ array(
'distinct' => false,
'drop_database' => false,
'group' => false,
@@ -304,7 +304,7 @@ class QueryTest extends TestCase
'reload' => false,
'select_from' => false,
'union' => false,
- ],
+ ),
Query::getAll('')
);
@@ -314,21 +314,21 @@ class QueryTest extends TestCase
$this->assertEquals(
array_merge(
Query::getFlags($parser->statements[0], true),
- [
+ array(
'parser' => $parser,
'statement' => $parser->statements[0],
- 'select_expr' => ['*'],
- 'select_tables' => [
- [
+ 'select_expr' => array('*'),
+ 'select_tables' => array(
+ array(
'actor',
null,
- ],
- [
+ ),
+ array(
'film',
'sakila2',
- ],
- ],
- ]
+ ),
+ )
+ )
),
Query::getAll($query)
);
@@ -338,21 +338,21 @@ class QueryTest extends TestCase
$this->assertEquals(
array_merge(
Query::getFlags($parser->statements[0], true),
- [
+ array(
'parser' => $parser,
'statement' => $parser->statements[0],
- 'select_expr' => ['*'],
- 'select_tables' => [
- [
+ 'select_expr' => array('*'),
+ 'select_tables' => array(
+ array(
'actor',
'sakila',
- ],
- [
+ ),
+ array(
'film',
null,
- ],
- ],
- ]
+ ),
+ )
+ )
),
Query::getAll($query)
);
@@ -362,17 +362,17 @@ class QueryTest extends TestCase
$this->assertEquals(
array_merge(
Query::getFlags($parser->statements[0], true),
- [
+ array(
'parser' => $parser,
'statement' => $parser->statements[0],
- 'select_expr' => [],
- 'select_tables' => [
- [
+ 'select_expr' => array(),
+ 'select_tables' => array(
+ array(
'actor',
'sakila',
- ],
- ],
- ]
+ ),
+ ),
+ )
),
Query::getAll($query)
);
@@ -382,14 +382,14 @@ class QueryTest extends TestCase
$this->assertEquals(
array_merge(
Query::getFlags($parser->statements[0], true),
- [
+ array(
'parser' => $parser,
'statement' => $parser->statements[0],
- 'select_expr' => [
+ 'select_expr' => array(
'CASE WHEN 2 IS NULL THEN "this is true" ELSE "this is false" END',
- ],
- 'select_tables' => [],
- ]
+ ),
+ 'select_tables' => array(),
+ )
),
Query::getAll($query)
);
@@ -412,42 +412,42 @@ class QueryTest extends TestCase
public function getTablesProvider()
{
- return [
- [
+ return array(
+ array(
'INSERT INTO tbl(`id`, `name`) VALUES (1, "Name")',
- ['`tbl`'],
- ],
- [
+ array('`tbl`')
+ ),
+ array(
'UPDATE tbl SET id = 0',
- ['`tbl`'],
- ],
- [
+ array('`tbl`')
+ ),
+ array(
'DELETE FROM tbl WHERE id < 10',
- ['`tbl`'],
- ],
- [
+ array('`tbl`')
+ ),
+ array(
'TRUNCATE tbl',
- ['`tbl`'],
- ],
- [
+ array('`tbl`')
+ ),
+ array(
'DROP VIEW v',
- [],
- ],
- [
+ array()
+ ),
+ array(
'DROP TABLE tbl1, tbl2',
- [
+ array(
'`tbl1`',
'`tbl2`',
- ],
- ],
- [
+ ),
+ ),
+ array(
'RENAME TABLE a TO b, c TO d',
- [
+ array(
'`a`',
- '`c`',
- ],
- ],
- ];
+ '`c`'
+ )
+ )
+ );
}
public function testGetClause()
@@ -601,7 +601,7 @@ class QueryTest extends TestCase
public function testReplaceClauses()
{
- $this->assertEquals('', Query::replaceClauses(null, null, []));
+ $this->assertEquals('', Query::replaceClauses(null, null, array()));
$parser = new Parser('SELECT *, (SELECT 1) FROM film LIMIT 0, 10;');
$this->assertEquals(
@@ -609,12 +609,12 @@ class QueryTest extends TestCase
Query::replaceClauses(
$parser->statements[0],
$parser->list,
- [
- [
+ array(
+ array(
'WHERE',
'WHERE film_id > 0',
- ],
- ]
+ )
+ )
)
);
@@ -635,20 +635,20 @@ class QueryTest extends TestCase
Query::replaceClauses(
$parser->statements[0],
$parser->list,
- [
- [
+ array(
+ array(
'FROM',
'FROM city AS c',
- ],
- [
+ ),
+ array(
'WHERE',
'',
- ],
- [
+ ),
+ array(
'LIMIT',
'LIMIT 0, 10',
- ],
- ]
+ )
+ )
)
);
}
diff --git a/tests/Utils/RoutineTest.php b/tests/Utils/RoutineTest.php
index 81a8325..fe45798 100644
--- a/tests/Utils/RoutineTest.php
+++ b/tests/Utils/RoutineTest.php
@@ -21,88 +21,88 @@ class RoutineTest extends TestCase
public function getReturnTypeProvider()
{
- return [
- [
+ return array(
+ array(
'',
- [
+ array(
'',
'',
'',
'',
'',
- ],
- ],
- [
+ ),
+ ),
+ array(
'TEXT',
- [
+ array(
'',
'',
'TEXT',
'',
'',
- ],
- ],
- [
+ ),
+ ),
+ array(
'INT(20)',
- [
+ array(
'',
'',
'INT',
'20',
'',
- ],
- ],
- [
+ ),
+ ),
+ array(
'INT UNSIGNED',
- [
+ array(
'',
'',
'INT',
'',
'UNSIGNED',
- ],
- ],
- [
+ ),
+ ),
+ array(
'VARCHAR(1) CHARSET utf8',
- [
+ array(
'',
'',
'VARCHAR',
'1',
'utf8',
- ],
- ],
- [
+ ),
+ ),
+ array(
'ENUM(\'a\', \'b\') CHARSET latin1',
- [
+ array(
'',
'',
'ENUM',
'\'a\',\'b\'',
'latin1',
- ],
- ],
- [
+ ),
+ ),
+ array(
'DECIMAL(5,2) UNSIGNED ZEROFILL',
- [
+ array(
'',
'',
'DECIMAL',
'5,2',
'UNSIGNED ZEROFILL',
- ],
- ],
- [
+ ),
+ ),
+ array(
'SET(\'test\'\'esc"\', \'more\\\'esc\')',
- [
+ array(
'',
'',
'SET',
'\'test\'\'esc"\',\'more\\\'esc\'',
'',
- ],
- ],
- ];
+ ),
+ )
+ );
}
/**
@@ -117,88 +117,88 @@ class RoutineTest extends TestCase
public function getParameterProvider()
{
- return [
- [
+ return array(
+ array(
'',
- [
+ array(
'',
'',
'',
'',
'',
- ],
- ],
- [
+ ),
+ ),
+ array(
'`foo` TEXT',
- [
+ array(
'',
'foo',
'TEXT',
'',
'',
- ],
- ],
- [
+ ),
+ ),
+ array(
'`foo` INT(20)',
- [
+ array(
'',
'foo',
'INT',
'20',
'',
- ],
- ],
- [
+ ),
+ ),
+ array(
'IN `fo``fo` INT UNSIGNED',
- [
+ array(
'IN',
'fo`fo',
'INT',
'',
'UNSIGNED',
- ],
- ],
- [
+ ),
+ ),
+ array(
'OUT bar VARCHAR(1) CHARSET utf8',
- [
+ array(
'OUT',
'bar',
'VARCHAR',
'1',
'utf8',
- ],
- ],
- [
+ ),
+ ),
+ array(
'`"baz\'\'` ENUM(\'a\', \'b\') CHARSET latin1',
- [
+ array(
'',
'"baz\'\'',
'ENUM',
'\'a\',\'b\'',
'latin1',
- ],
- ],
- [
+ ),
+ ),
+ array(
'INOUT `foo` DECIMAL(5,2) UNSIGNED ZEROFILL',
- [
+ array(
'INOUT',
'foo',
'DECIMAL',
'5,2',
'UNSIGNED ZEROFILL',
- ],
- ],
- [
+ ),
+ ),
+ array(
'`foo``s func` SET(\'test\'\'esc"\', \'more\\\'esc\')',
- [
+ array(
'',
'foo`s func',
'SET',
'\'test\'\'esc"\',\'more\\\'esc\'',
'',
- ],
- ],
- ];
+ ),
+ )
+ );
}
/**
@@ -214,98 +214,98 @@ class RoutineTest extends TestCase
public function getParametersProvider()
{
- return [
- [
+ return array(
+ array(
'CREATE PROCEDURE `foo`() SET @A=0',
- [
+ array(
'num' => 0,
- 'dir' => [],
- 'name' => [],
- 'type' => [],
- 'length' => [],
- 'length_arr' => [],
- 'opts' => [],
- ],
- ],
- [
+ 'dir' => array(),
+ 'name' => array(),
+ 'type' => array(),
+ 'length' => array(),
+ 'length_arr' => array(),
+ 'opts' => array(),
+ ),
+ ),
+ array(
'CREATE DEFINER=`user\\`@`somehost``(` FUNCTION `foo```(`baz` INT) BEGIN SELECT NULL; END',
- [
+ array(
'num' => 1,
- 'dir' => [
+ 'dir' => array(
0 => '',
- ],
- 'name' => [
+ ),
+ 'name' => array(
0 => 'baz',
- ],
- 'type' => [
+ ),
+ 'type' => array(
0 => 'INT',
- ],
- 'length' => [
+ ),
+ 'length' => array(
0 => '',
- ],
- 'length_arr' => [
- 0 => [],
- ],
- 'opts' => [
+ ),
+ 'length_arr' => array(
+ 0 => array(),
+ ),
+ 'opts' => array(
0 => '',
- ],
- ],
- ],
- [
+ ),
+ ),
+ ),
+ array(
'CREATE PROCEDURE `foo`(IN `baz\\)` INT(25) zerofill unsigned) BEGIN SELECT NULL; END',
- [
+ array(
'num' => 1,
- 'dir' => [
+ 'dir' => array(
0 => 'IN',
- ],
- 'name' => [
+ ),
+ 'name' => array(
0 => 'baz\\)',
- ],
- 'type' => [
+ ),
+ 'type' => array(
0 => 'INT',
- ],
- 'length' => [
+ ),
+ 'length' => array(
0 => '25',
- ],
- 'length_arr' => [
- 0 => ['25'],
- ],
- 'opts' => [
+ ),
+ 'length_arr' => array(
+ 0 => array('25'),
+ ),
+ 'opts' => array(
0 => 'UNSIGNED ZEROFILL',
- ],
- ],
- ],
- [
+ ),
+ ),
+ ),
+ array(
'CREATE PROCEDURE `foo`(IN `baz\\` INT(001) zerofill, out bazz varchar(15) charset utf8) ' .
'BEGIN SELECT NULL; END',
- [
+ array(
'num' => 2,
- 'dir' => [
+ 'dir' => array(
0 => 'IN',
1 => 'OUT',
- ],
- 'name' => [
+ ),
+ 'name' => array(
0 => 'baz\\',
1 => 'bazz',
- ],
- 'type' => [
+ ),
+ 'type' => array(
0 => 'INT',
1 => 'VARCHAR',
- ],
- 'length' => [
+ ),
+ 'length' => array(
0 => '1',
1 => '15',
- ],
- 'length_arr' => [
- 0 => ['1'],
- 1 => ['15'],
- ],
- 'opts' => [
+ ),
+ 'length_arr' => array(
+ 0 => array('1'),
+ 1 => array('15'),
+ ),
+ 'opts' => array(
0 => 'ZEROFILL',
1 => 'utf8',
- ],
- ],
- ],
- ];
+ ),
+ ),
+ )
+ );
}
}
diff --git a/tests/Utils/TableTest.php b/tests/Utils/TableTest.php
index 9d5d3b0..06aa1fb 100644
--- a/tests/Utils/TableTest.php
+++ b/tests/Utils/TableTest.php
@@ -22,12 +22,12 @@ class TableTest extends TestCase
public function getForeignKeysProvider()
{
- return [
- [
+ return array(
+ array(
'CREATE USER test',
- [],
- ],
- [
+ array(),
+ ),
+ array(
'CREATE TABLE `payment` (
`payment_id` smallint(5) unsigned NOT NULL AUTO_INCREMENT,
`customer_id` smallint(5) unsigned NOT NULL,
@@ -44,35 +44,35 @@ class TableTest extends TestCase
CONSTRAINT `fk_payment_rental` FOREIGN KEY (`rental_id`) REFERENCES `rental` (`rental_id`) ON DELETE SET NULL ON UPDATE CASCADE,
CONSTRAINT `fk_payment_staff` FOREIGN KEY (`staff_id`) REFERENCES `staff` (`staff_id`) ON UPDATE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=16050 DEFAULT CHARSET=utf8',
- [
- [
+ array(
+ array(
'constraint' => 'fk_payment_customer',
- 'index_list' => ['customer_id'],
+ 'index_list' => array('customer_id'),
'ref_db_name' => null,
'ref_table_name' => 'customer',
- 'ref_index_list' => ['customer_id'],
+ 'ref_index_list' => array('customer_id'),
'on_update' => 'CASCADE',
- ],
- [
+ ),
+ array(
'constraint' => 'fk_payment_rental',
- 'index_list' => ['rental_id'],
+ 'index_list' => array('rental_id'),
'ref_db_name' => null,
'ref_table_name' => 'rental',
- 'ref_index_list' => ['rental_id'],
+ 'ref_index_list' => array('rental_id'),
'on_delete' => 'SET_NULL',
'on_update' => 'CASCADE',
- ],
- [
+ ),
+ array(
'constraint' => 'fk_payment_staff',
- 'index_list' => ['staff_id'],
+ 'index_list' => array('staff_id'),
'ref_db_name' => null,
'ref_table_name' => 'staff',
- 'ref_index_list' => ['staff_id'],
+ 'ref_index_list' => array('staff_id'),
'on_update' => 'CASCADE',
- ],
- ],
- ],
- [
+ ),
+ ),
+ ),
+ array(
'CREATE TABLE `actor` (
`actor_id` smallint(5) unsigned NOT NULL AUTO_INCREMENT,
`first_name` varchar(45) NOT NULL,
@@ -81,9 +81,9 @@ class TableTest extends TestCase
PRIMARY KEY (`actor_id`),
KEY `idx_actor_last_name` (`last_name`)
) ENGINE=InnoDB AUTO_INCREMENT=201 DEFAULT CHARSET=utf8',
- [],
- ],
- [
+ array(),
+ ),
+ array(
'CREATE TABLE `address` (
`address_id` smallint(5) unsigned NOT NULL AUTO_INCREMENT,
`address` varchar(50) NOT NULL,
@@ -97,18 +97,18 @@ class TableTest extends TestCase
KEY `idx_fk_city_id` (`city_id`),
CONSTRAINT `fk_address_city` FOREIGN KEY (`city_id`) REFERENCES `city` (`city_id`) ON UPDATE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=606 DEFAULT CHARSET=utf8',
- [
- [
+ array(
+ array(
'constraint' => 'fk_address_city',
- 'index_list' => ['city_id'],
+ 'index_list' => array('city_id'),
'ref_db_name' => null,
'ref_table_name' => 'city',
- 'ref_index_list' => ['city_id'],
+ 'ref_index_list' => array('city_id'),
'on_update' => 'CASCADE',
- ],
- ],
- ],
- ];
+ ),
+ ),
+ )
+ );
}
/**
@@ -124,12 +124,12 @@ class TableTest extends TestCase
public function getFieldsProvider()
{
- return [
- [
+ return array(
+ array(
'CREATE USER test',
- [],
- ],
- [
+ array(),
+ ),
+ array(
'CREATE TABLE `address` (
`address_id` smallint(5) unsigned NOT NULL AUTO_INCREMENT,
`address` varchar(50) NOT NULL,
@@ -143,76 +143,76 @@ class TableTest extends TestCase
KEY `idx_fk_city_id` (`city_id`),
CONSTRAINT `fk_address_city` FOREIGN KEY (`city_id`) REFERENCES `city` (`city_id`) ON UPDATE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=606 DEFAULT CHARSET=utf8',
- [
- 'address_id' => [
+ array(
+ 'address_id' => array(
'type' => 'SMALLINT',
'timestamp_not_null' => false,
- ],
- 'address' => [
+ ),
+ 'address' => array(
'type' => 'VARCHAR',
'timestamp_not_null' => false,
- ],
- 'address2' => [
+ ),
+ 'address2' => array(
'type' => 'VARCHAR',
'timestamp_not_null' => false,
'default_value' => 'NULL',
- ],
- 'district' => [
+ ),
+ 'district' => array(
'type' => 'VARCHAR',
'timestamp_not_null' => false,
- ],
- 'city_id' => [
+ ),
+ 'city_id' => array(
'type' => 'SMALLINT',
'timestamp_not_null' => false,
- ],
- 'postal_code' => [
+ ),
+ 'postal_code' => array(
'type' => 'VARCHAR',
'timestamp_not_null' => false,
'default_value' => 'NULL',
- ],
- 'phone' => [
+ ),
+ 'phone' => array(
'type' => 'VARCHAR',
'timestamp_not_null' => false,
- ],
- 'last_update' => [
+ ),
+ 'last_update' => array(
'type' => 'TIMESTAMP',
'timestamp_not_null' => true,
'default_value' => 'CURRENT_TIMESTAMP',
'default_current_timestamp' => true,
'on_update_current_timestamp' => true,
- ],
- ],
- ],
- [
+ ),
+ ),
+ ),
+ array(
'CREATE TABLE table1 (
a INT NOT NULL,
b VARCHAR(32),
c INT AS (a mod 10) VIRTUAL,
d VARCHAR(5) AS (left(b,5)) PERSISTENT
)',
- [
- 'a' => [
+ array(
+ 'a' => array(
'type' => 'INT',
'timestamp_not_null' => false,
- ],
- 'b' => [
+ ),
+ 'b' => array(
'type' => 'VARCHAR',
'timestamp_not_null' => false,
- ],
- 'c' => [
+ ),
+ 'c' => array(
'type' => 'INT',
'timestamp_not_null' => false,
'generated' => true,
'expr' => '(a mod 10)',
- ],
- 'd' => [
+ ),
+ 'd' => array(
'type' => 'VARCHAR',
'timestamp_not_null' => false,
'generated' => true,
'expr' => '(left(b,5))',
- ],
- ],
- ],
- ];
+ ),
+ ),
+ )
+ );
}
}
diff --git a/tests/Utils/TokensTest.php b/tests/Utils/TokensTest.php
index 200dfe6..4d38a1a 100644
--- a/tests/Utils/TokensTest.php
+++ b/tests/Utils/TokensTest.php
@@ -24,20 +24,20 @@ class TokensTest extends TestCase
public function replaceTokensProvider()
{
- return [
- [
+ return array(
+ array(
'SELECT * FROM /*x*/a/*c*/.b',
- [
- ['value_str' => 'a'],
- ['token' => '.'],
- ],
- [
+ array(
+ array('value_str' => 'a'),
+ array('token' => '.'),
+ ),
+ array(
new Token('c'),
new Token('.'),
- ],
+ ),
'SELECT * FROM /*x*/c.b',
- ],
- ];
+ )
+ );
}
/**
@@ -54,64 +54,64 @@ class TokensTest extends TestCase
public function matchProvider()
{
- return [
- [
+ return array(
+ array(
new Token(''),
- [],
+ array(),
true,
- ],
+ ),
- [
+ array(
new Token('"abc"', Token::TYPE_STRING, Token::FLAG_STRING_DOUBLE_QUOTES),
- ['token' => '"abc"'],
+ array('token' => '"abc"'),
true,
- ],
- [
+ ),
+ array(
new Token('"abc"', Token::TYPE_STRING, Token::FLAG_STRING_DOUBLE_QUOTES),
- ['value' => 'abc'],
+ array('value' => 'abc'),
true,
- ],
- [
+ ),
+ array(
new Token('"abc"', Token::TYPE_STRING, Token::FLAG_STRING_DOUBLE_QUOTES),
- ['value_str' => 'ABC'],
+ array('value_str' => 'ABC'),
true,
- ],
- [
+ ),
+ array(
new Token('"abc"', Token::TYPE_STRING, Token::FLAG_STRING_DOUBLE_QUOTES),
- ['type' => Token::TYPE_STRING],
+ array('type' => Token::TYPE_STRING),
true,
- ],
- [
+ ),
+ array(
new Token('"abc"', Token::TYPE_STRING, Token::FLAG_STRING_DOUBLE_QUOTES),
- ['flags' => Token::FLAG_STRING_DOUBLE_QUOTES],
+ array('flags' => Token::FLAG_STRING_DOUBLE_QUOTES),
true,
- ],
+ ),
- [
+ array(
new Token('"abc"', Token::TYPE_STRING, Token::FLAG_STRING_DOUBLE_QUOTES),
- ['token' => '"abcd"'],
+ array('token' => '"abcd"'),
false,
- ],
- [
+ ),
+ array(
new Token('"abc"', Token::TYPE_STRING, Token::FLAG_STRING_DOUBLE_QUOTES),
- ['value' => 'abcd'],
+ array('value' => 'abcd'),
false,
- ],
- [
+ ),
+ array(
new Token('"abc"', Token::TYPE_STRING, Token::FLAG_STRING_DOUBLE_QUOTES),
- ['value_str' => 'ABCd'],
+ array('value_str' => 'ABCd'),
false,
- ],
- [
+ ),
+ array(
new Token('"abc"', Token::TYPE_STRING, Token::FLAG_STRING_DOUBLE_QUOTES),
- ['type' => Token::TYPE_NUMBER],
+ array('type' => Token::TYPE_NUMBER),
false,
- ],
- [
+ ),
+ array(
new Token('"abc"', Token::TYPE_STRING, Token::FLAG_STRING_DOUBLE_QUOTES),
- ['flags' => Token::FLAG_STRING_SINGLE_QUOTES],
+ array('flags' => Token::FLAG_STRING_SINGLE_QUOTES),
false,
- ],
- ];
+ )
+ );
}
}
diff --git a/tools/ContextGenerator.php b/tools/ContextGenerator.php
index 9279dee..2f76a74 100644
--- a/tools/ContextGenerator.php
+++ b/tools/ContextGenerator.php
@@ -19,19 +19,19 @@ class ContextGenerator
*
* @var array
*/
- public static $LABELS_FLAGS = [
+ public static $LABELS_FLAGS = array(
'(R)' => 2, // reserved
'(D)' => 8, // data type
'(K)' => 16, // keyword
- '(F)' => 32, // function name
- ];
+ '(F)' => 32 // function name
+ );
/**
* Documentation links for each context.
*
* @var array
*/
- public static $LINKS = [
+ public static $LINKS = array(
'MySql50000' => 'https://dev.mysql.com/doc/refman/5.0/en/keywords.html',
'MySql50100' => 'https://dev.mysql.com/doc/refman/5.1/en/keywords.html',
'MySql50500' => 'https://dev.mysql.com/doc/refman/5.5/en/keywords.html',
@@ -41,8 +41,8 @@ class ContextGenerator
'MariaDb100000' => 'https://mariadb.com/kb/en/the-mariadb-library/reserved-words/',
'MariaDb100100' => 'https://mariadb.com/kb/en/the-mariadb-library/reserved-words/',
'MariaDb100200' => 'https://mariadb.com/kb/en/the-mariadb-library/reserved-words/',
- 'MariaDb100300' => 'https://mariadb.com/kb/en/the-mariadb-library/reserved-words/',
- ];
+ 'MariaDb100300' => 'https://mariadb.com/kb/en/the-mariadb-library/reserved-words/'
+ );
/**
* The template of a context.
@@ -91,9 +91,9 @@ class ContextGenerator
' *' . "\n" .
' * @var array' . "\n" .
' */' . "\n" .
- ' public static $KEYWORDS = [' . "\n" .
+ ' public static $KEYWORDS = array(' . "\n" .
'%4$s' .
- ' ];' . "\n" .
+ ' );' . "\n" .
'}' . "\n";
/**
@@ -335,18 +335,18 @@ class ContextGenerator
file_put_contents(
$output . '/' . $class . '.php',
static::generate(
- [
+ array(
'name' => $formattedName,
'class' => $class,
'link' => static::$LINKS[$name],
'keywords' => static::readWords(
- [
+ array(
$directory . '_common.txt',
$directory . '_functions' . $file,
- $directory . $file,
- ]
- ),
- ]
+ $directory . $file
+ )
+ )
+ )
)
);
}
diff --git a/tools/TestGenerator.php b/tools/TestGenerator.php
index 296a29f..e429990 100644
--- a/tools/TestGenerator.php
+++ b/tools/TestGenerator.php
@@ -64,12 +64,12 @@ class TestGenerator
// Extracting lexer's errors.
if (! empty($lexer->errors)) {
foreach ($lexer->errors as $err) {
- $lexerErrors[] = [
+ $lexerErrors[] = array(
$err->getMessage(),
$err->ch,
$err->pos,
- $err->getCode(),
- ];
+ $err->getCode()
+ );
}
$lexer->errors = array();
}
@@ -77,24 +77,24 @@ class TestGenerator
// Extracting parser's errors.
if (! empty($parser->errors)) {
foreach ($parser->errors as $err) {
- $parserErrors[] = [
+ $parserErrors[] = array(
$err->getMessage(),
$err->token,
- $err->getCode(),
- ];
+ $err->getCode()
+ );
}
$parser->errors = array();
}
- return [
+ return array(
'query' => $query,
'lexer' => $lexer,
'parser' => $parser,
- 'errors' => [
+ 'errors' => array(
'lexer' => $lexerErrors,
'parser' => $parserErrors,
- ],
- ];
+ )
+ );
}
/**