diff --git a/CHANGELOG.md b/CHANGELOG.md index 25a51ff7e..35b33c0dd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,13 +6,18 @@ - Move `Misc::getAliases()` into `SelectStatement::getAliases()` (#454) - Drop `USE_UTF_STRINGS` constant (#471) -## [5.x.x] - YYYY-MM-DD +## [5.9.x] - YYYY-MM-DD + +## [5.8.x] - YYYY-MM-DD + +## [5.8.1] - 2023-09-15 - Fix `:=` was not recognized as an operator just like `=` (#306) - Fix `ALTER TABLE … MODIFY … ENUM('')` is being wrongly parsed (#234) - Fix `ALTER TABLE … MODIFY … ENUM('')` is being wrongly parsed (#478) - Fix MariaDB window function with alias gives bad linting errors (#283) - Fix unrecognized keyword `COLLATE` in `WHERE` clauses (#491) +- Fix invalid hexadecimal prefix 0X (#508) ## [5.8.0] - 2023-06-05 diff --git a/phpcs.xml.dist b/phpcs.xml.dist index e19cce16d..07e829c2d 100644 --- a/phpcs.xml.dist +++ b/phpcs.xml.dist @@ -66,9 +66,6 @@ 4 - - 4 - 4 diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index 89f4390ee..f4e814b53 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -5,11 +5,6 @@ parameters: count: 3 path: src/Components/AlterOperation.php - - - message: "#^Parameter \\#1 \\$key of function array_key_exists expects int\\|string, float\\|int\\|string given\\.$#" - count: 2 - path: src/Components/AlterOperation.php - - message: "#^Property PhpMyAdmin\\\\SqlParser\\\\Components\\\\AlterOperation\\:\\:\\$options \\(PhpMyAdmin\\\\SqlParser\\\\Components\\\\OptionsArray\\) does not accept PhpMyAdmin\\\\SqlParser\\\\Components\\\\OptionsArray\\|null\\.$#" count: 1 diff --git a/psalm-baseline.xml b/psalm-baseline.xml index 673d8b242..faa8f9085 100644 --- a/psalm-baseline.xml +++ b/psalm-baseline.xml @@ -38,9 +38,6 @@ 'DO' => 10, ]]]> - - value]]]> - $arrayKey @@ -773,9 +770,6 @@ $built[$field] value]]]> - - __toString - value]]]> value]]]> @@ -1127,9 +1121,6 @@ - - __toString - $byteLen diff --git a/src/Component.php b/src/Component.php index 5ba42fd1d..d1c44567b 100644 --- a/src/Component.php +++ b/src/Component.php @@ -22,10 +22,8 @@ interface Component extends Stringable * @param Parser $parser the parser that serves as context * @param TokensList $list the list of tokens that are being parsed * @param array $options parameters for parsing - * - * @return mixed */ - public static function parse(Parser $parser, TokensList $list, array $options = []); + public static function parse(Parser $parser, TokensList $list, array $options = []): mixed; /** * Builds the string representation of a component of this type. diff --git a/src/Components/AlterOperation.php b/src/Components/AlterOperation.php index 078892dcf..bc2d85fd2 100644 --- a/src/Components/AlterOperation.php +++ b/src/Components/AlterOperation.php @@ -11,7 +11,7 @@ use function array_key_exists; use function in_array; -use function is_numeric; +use function is_int; use function is_string; use function trim; @@ -300,10 +300,8 @@ public function __construct( * @param Parser $parser the parser that serves as context * @param TokensList $list the list of tokens that are being parsed * @param array $options parameters for parsing - * - * @return AlterOperation */ - public static function parse(Parser $parser, TokensList $list, array $options = []) + public static function parse(Parser $parser, TokensList $list, array $options = []): AlterOperation { $ret = new static(); @@ -410,7 +408,7 @@ public static function parse(Parser $parser, TokensList $list, array $options = $state = 2; } elseif ($state === 2) { - if (is_string($token->value) || is_numeric($token->value)) { + if (is_string($token->value) || is_int($token->value)) { $arrayKey = $token->value; } else { $arrayKey = $token->token; @@ -443,7 +441,7 @@ public static function parse(Parser $parser, TokensList $list, array $options = ); break; } - } elseif (! empty(Parser::$statementParsers[$token->value])) { + } elseif (! empty(Parser::$statementParsers[$arrayKey])) { // We have reached the end of ALTER operation and suddenly found // a start to new statement, but have not found a delimiter between them $parser->error( diff --git a/src/Components/ArrayObj.php b/src/Components/ArrayObj.php index c860b64de..6d890beae 100644 --- a/src/Components/ArrayObj.php +++ b/src/Components/ArrayObj.php @@ -49,7 +49,7 @@ public function __construct(array $raw = [], array $values = []) * * @return ArrayObj|Component[] */ - public static function parse(Parser $parser, TokensList $list, array $options = []) + public static function parse(Parser $parser, TokensList $list, array $options = []): ArrayObj|array { $ret = empty($options['type']) ? new static() : []; @@ -89,6 +89,10 @@ public static function parse(Parser $parser, TokensList $list, array $options = // End of statement. if ($token->type === Token::TYPE_DELIMITER) { + if ($brackets > 0) { + $parser->error('A closing bracket was expected.', $token); + } + break; } diff --git a/src/Components/CaseExpression.php b/src/Components/CaseExpression.php index 6ffe3c23e..d880856de 100644 --- a/src/Components/CaseExpression.php +++ b/src/Components/CaseExpression.php @@ -70,10 +70,8 @@ final class CaseExpression implements Component * @param Parser $parser the parser that serves as context * @param TokensList $list the list of tokens that are being parsed * @param array $options parameters for parsing - * - * @return CaseExpression */ - public static function parse(Parser $parser, TokensList $list, array $options = []) + public static function parse(Parser $parser, TokensList $list, array $options = []): CaseExpression { $ret = new static(); diff --git a/src/Components/CreateDefinition.php b/src/Components/CreateDefinition.php index bfadb0577..4d00b9738 100644 --- a/src/Components/CreateDefinition.php +++ b/src/Components/CreateDefinition.php @@ -180,7 +180,7 @@ public function __construct( * * @return CreateDefinition[] */ - public static function parse(Parser $parser, TokensList $list, array $options = []) + public static function parse(Parser $parser, TokensList $list, array $options = []): array { $ret = []; diff --git a/src/Components/DataType.php b/src/Components/DataType.php index 651317e84..31a5d3cc9 100644 --- a/src/Components/DataType.php +++ b/src/Components/DataType.php @@ -93,10 +93,8 @@ public function __construct( * @param Parser $parser the parser that serves as context * @param TokensList $list the list of tokens that are being parsed * @param array $options parameters for parsing - * - * @return DataType|null */ - public static function parse(Parser $parser, TokensList $list, array $options = []) + public static function parse(Parser $parser, TokensList $list, array $options = []): DataType|null { $ret = new static(); diff --git a/src/Components/FunctionCall.php b/src/Components/FunctionCall.php index 1bc2e7908..f634940fd 100644 --- a/src/Components/FunctionCall.php +++ b/src/Components/FunctionCall.php @@ -48,10 +48,8 @@ public function __construct($name = null, $parameters = null) * @param Parser $parser the parser that serves as context * @param TokensList $list the list of tokens that are being parsed * @param array $options parameters for parsing - * - * @return FunctionCall */ - public static function parse(Parser $parser, TokensList $list, array $options = []) + public static function parse(Parser $parser, TokensList $list, array $options = []): FunctionCall { $ret = new static(); diff --git a/src/Components/IntoKeyword.php b/src/Components/IntoKeyword.php index c5f19ef5c..bf1aadf48 100644 --- a/src/Components/IntoKeyword.php +++ b/src/Components/IntoKeyword.php @@ -137,10 +137,8 @@ public function __construct( * @param Parser $parser the parser that serves as context * @param TokensList $list the list of tokens that are being parsed * @param array $options parameters for parsing - * - * @return IntoKeyword */ - public static function parse(Parser $parser, TokensList $list, array $options = []) + public static function parse(Parser $parser, TokensList $list, array $options = []): IntoKeyword { $ret = new static(); diff --git a/src/Components/Key.php b/src/Components/Key.php index 9f154116d..aa356f440 100644 --- a/src/Components/Key.php +++ b/src/Components/Key.php @@ -123,10 +123,8 @@ public function __construct( * @param Parser $parser the parser that serves as context * @param TokensList $list the list of tokens that are being parsed * @param array $options parameters for parsing - * - * @return Key */ - public static function parse(Parser $parser, TokensList $list, array $options = []) + public static function parse(Parser $parser, TokensList $list, array $options = []): Key { $ret = new static(); diff --git a/src/Components/Limit.php b/src/Components/Limit.php index b22b73950..9adcaf13e 100644 --- a/src/Components/Limit.php +++ b/src/Components/Limit.php @@ -42,10 +42,8 @@ public function __construct($rowCount = 0, $offset = 0) * @param Parser $parser the parser that serves as context * @param TokensList $list the list of tokens that are being parsed * @param array $options parameters for parsing - * - * @return Limit */ - public static function parse(Parser $parser, TokensList $list, array $options = []) + public static function parse(Parser $parser, TokensList $list, array $options = []): Limit { $ret = new static(); diff --git a/src/Components/LockExpression.php b/src/Components/LockExpression.php index 1f1a4c52c..ec2508c0d 100644 --- a/src/Components/LockExpression.php +++ b/src/Components/LockExpression.php @@ -34,10 +34,8 @@ final class LockExpression implements Component * @param Parser $parser the parser that serves as context * @param TokensList $list the list of tokens that are being parsed * @param array $options parameters for parsing - * - * @return LockExpression */ - public static function parse(Parser $parser, TokensList $list, array $options = []) + public static function parse(Parser $parser, TokensList $list, array $options = []): LockExpression { $ret = new static(); @@ -106,10 +104,7 @@ public static function buildAll(array $component): string return implode(', ', $component); } - /** - * @return string - */ - private static function parseLockType(Parser $parser, TokensList $list) + private static function parseLockType(Parser $parser, TokensList $list): string { $lockType = ''; diff --git a/src/Components/OptionsArray.php b/src/Components/OptionsArray.php index 358304e02..5482120a1 100644 --- a/src/Components/OptionsArray.php +++ b/src/Components/OptionsArray.php @@ -37,10 +37,8 @@ public function __construct(public array $options = []) * @param Parser $parser the parser that serves as context * @param TokensList $list the list of tokens that are being parsed * @param array $options parameters for parsing - * - * @return OptionsArray */ - public static function parse(Parser $parser, TokensList $list, array $options = []) + public static function parse(Parser $parser, TokensList $list, array $options = []): OptionsArray { $ret = new static(); @@ -292,10 +290,8 @@ public function build(): string * @param string $key the key to be checked * @param bool $getExpr Gets the expression instead of the value. * The value is the processed form of the expression. - * - * @return mixed */ - public function has($key, $getExpr = false) + public function has($key, $getExpr = false): mixed { foreach ($this->options as $option) { if (is_array($option)) { diff --git a/src/Components/PartitionDefinition.php b/src/Components/PartitionDefinition.php index 978ca5a03..68fe2e0f0 100644 --- a/src/Components/PartitionDefinition.php +++ b/src/Components/PartitionDefinition.php @@ -110,10 +110,8 @@ final class PartitionDefinition implements Component * @param Parser $parser the parser that serves as context * @param TokensList $list the list of tokens that are being parsed * @param array $options parameters for parsing - * - * @return PartitionDefinition */ - public static function parse(Parser $parser, TokensList $list, array $options = []) + public static function parse(Parser $parser, TokensList $list, array $options = []): PartitionDefinition { $ret = new static(); diff --git a/src/Components/Reference.php b/src/Components/Reference.php index 9e0f1b276..17b37bda8 100644 --- a/src/Components/Reference.php +++ b/src/Components/Reference.php @@ -76,10 +76,8 @@ public function __construct($table = null, array $columns = [], $options = null) * @param Parser $parser the parser that serves as context * @param TokensList $list the list of tokens that are being parsed * @param array $options parameters for parsing - * - * @return Reference */ - public static function parse(Parser $parser, TokensList $list, array $options = []) + public static function parse(Parser $parser, TokensList $list, array $options = []): Reference { $ret = new static(); diff --git a/src/Components/UnionKeyword.php b/src/Components/UnionKeyword.php index 190b876dc..e07192ae3 100644 --- a/src/Components/UnionKeyword.php +++ b/src/Components/UnionKeyword.php @@ -24,11 +24,9 @@ final class UnionKeyword implements Component * @param TokensList $list the list of tokens that are being parsed * @param array $options parameters for parsing * - * @return mixed - * * @throws RuntimeException not implemented yet. */ - public static function parse(Parser $parser, TokensList $list, array $options = []) + public static function parse(Parser $parser, TokensList $list, array $options = []): mixed { throw new RuntimeException(Translator::gettext('Not implemented yet.')); } diff --git a/src/Components/WithKeyword.php b/src/Components/WithKeyword.php index 9dfea8e55..c98924b61 100644 --- a/src/Components/WithKeyword.php +++ b/src/Components/WithKeyword.php @@ -36,11 +36,9 @@ public function __construct(string $name) * @param TokensList $list the list of tokens that are being parsed * @param array $options parameters for parsing * - * @return mixed - * * @throws RuntimeException not implemented yet. */ - public static function parse(Parser $parser, TokensList $list, array $options = []) + public static function parse(Parser $parser, TokensList $list, array $options = []): mixed { throw new RuntimeException(Translator::gettext('Not implemented yet.')); } diff --git a/src/Context.php b/src/Context.php index 42c393244..068a0931c 100644 --- a/src/Context.php +++ b/src/Context.php @@ -10,6 +10,7 @@ use function intval; use function is_int; use function is_numeric; +use function preg_match; use function str_replace; use function str_starts_with; use function strlen; @@ -670,12 +671,14 @@ private static function getModeFromString(string $mode): int * * @param string $str the string to be escaped * @param string $quote quote to be used when escaping - * - * @return string */ - public static function escape(string $str, string $quote = '`') + public static function escape(string $str, string $quote = '`'): string { - if ((static::$mode & self::SQL_MODE_NO_ENCLOSING_QUOTES) && (! static::isKeyword($str, true))) { + if ( + (static::$mode & self::SQL_MODE_NO_ENCLOSING_QUOTES) && ! ( + static::isKeyword($str, true) || self::doesIdentifierRequireQuoting($str) + ) + ) { return $str; } @@ -727,4 +730,9 @@ public static function hasMode(int|null $flag = null): bool return (self::$mode & $flag) === $flag; } + + private static function doesIdentifierRequireQuoting(string $identifier): bool + { + return preg_match('/^[$]|^\d+$|[^0-9a-zA-Z$_\x80-\xffff]/', $identifier) === 1; + } } diff --git a/src/Contexts/ContextMariaDb100000.php b/src/Contexts/ContextMariaDb100000.php index 711fd7c85..b9893caec 100644 --- a/src/Contexts/ContextMariaDb100000.php +++ b/src/Contexts/ContextMariaDb100000.php @@ -34,12 +34,12 @@ class ContextMariaDb100000 extends Context '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, - 'BOOL' => 1, 'BYTE' => 1, 'CODE' => 1, 'CUBE' => 1, 'DATA' => 1, 'DISK' => 1, - 'ENDS' => 1, 'FAST' => 1, 'FILE' => 1, 'FULL' => 1, 'HASH' => 1, 'HELP' => 1, - 'HOST' => 1, 'LAST' => 1, 'LESS' => 1, 'LIST' => 1, 'LOGS' => 1, 'MODE' => 1, - 'NAME' => 1, 'NEXT' => 1, 'NONE' => 1, 'OPEN' => 1, 'PAGE' => 1, 'PORT' => 1, - 'PREV' => 1, 'ROWS' => 1, 'SLOW' => 1, 'SOME' => 1, 'STOP' => 1, 'THAN' => 1, - 'TYPE' => 1, 'VIEW' => 1, 'WAIT' => 1, 'WORK' => 1, 'X509' => 1, + 'BYTE' => 1, 'CODE' => 1, 'CUBE' => 1, 'DATA' => 1, 'DISK' => 1, 'ENDS' => 1, + 'FAST' => 1, 'FILE' => 1, 'FULL' => 1, 'HASH' => 1, 'HELP' => 1, 'HOST' => 1, + 'LAST' => 1, 'LESS' => 1, 'LIST' => 1, 'LOGS' => 1, 'MODE' => 1, 'NAME' => 1, + 'NEXT' => 1, 'NONE' => 1, 'OPEN' => 1, 'PAGE' => 1, 'PORT' => 1, 'PREV' => 1, + 'ROWS' => 1, 'SLOW' => 1, 'SOME' => 1, 'STOP' => 1, 'THAN' => 1, 'TYPE' => 1, + 'VIEW' => 1, 'WAIT' => 1, 'WORK' => 1, 'X509' => 1, 'AFTER' => 1, 'BEGIN' => 1, 'BLOCK' => 1, 'BTREE' => 1, 'CACHE' => 1, 'CHAIN' => 1, 'CLOSE' => 1, 'ERROR' => 1, 'EVENT' => 1, 'EVERY' => 1, 'FIRST' => 1, 'FIXED' => 1, 'FLUSH' => 1, 'FOUND' => 1, 'HOSTS' => 1, @@ -176,7 +176,7 @@ class ContextMariaDb100000 extends Context 'ON COMPLETION NOT PRESERVE' => 7, 'BIT' => 9, 'XML' => 9, - 'ENUM' => 9, 'JSON' => 9, 'TEXT' => 9, + 'BOOL' => 9, 'ENUM' => 9, 'JSON' => 9, 'TEXT' => 9, 'ARRAY' => 9, 'SERIAL' => 9, 'BOOLEAN' => 9, diff --git a/src/Contexts/ContextMariaDb100100.php b/src/Contexts/ContextMariaDb100100.php index 6506a037a..c3b593dec 100644 --- a/src/Contexts/ContextMariaDb100100.php +++ b/src/Contexts/ContextMariaDb100100.php @@ -34,12 +34,12 @@ class ContextMariaDb100100 extends Context '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, - 'BOOL' => 1, 'BYTE' => 1, 'CODE' => 1, 'CUBE' => 1, 'DATA' => 1, 'DISK' => 1, - 'ENDS' => 1, 'FAST' => 1, 'FILE' => 1, 'FULL' => 1, 'HASH' => 1, 'HELP' => 1, - 'HOST' => 1, 'LAST' => 1, 'LESS' => 1, 'LIST' => 1, 'LOGS' => 1, 'MODE' => 1, - 'NAME' => 1, 'NEXT' => 1, 'NONE' => 1, 'ONLY' => 1, 'OPEN' => 1, 'PAGE' => 1, - 'PORT' => 1, 'PREV' => 1, 'ROWS' => 1, 'SLOW' => 1, 'SOME' => 1, 'STOP' => 1, - 'THAN' => 1, 'TYPE' => 1, 'VIEW' => 1, 'WAIT' => 1, 'WORK' => 1, 'X509' => 1, + 'BYTE' => 1, 'CODE' => 1, 'CUBE' => 1, 'DATA' => 1, 'DISK' => 1, 'ENDS' => 1, + 'FAST' => 1, 'FILE' => 1, 'FULL' => 1, 'HASH' => 1, 'HELP' => 1, 'HOST' => 1, + 'LAST' => 1, 'LESS' => 1, 'LIST' => 1, 'LOGS' => 1, 'MODE' => 1, 'NAME' => 1, + 'NEXT' => 1, 'NONE' => 1, 'ONLY' => 1, 'OPEN' => 1, 'PAGE' => 1, 'PORT' => 1, + 'PREV' => 1, 'ROWS' => 1, 'SLOW' => 1, 'SOME' => 1, 'STOP' => 1, 'THAN' => 1, + 'TYPE' => 1, 'VIEW' => 1, 'WAIT' => 1, 'WORK' => 1, 'X509' => 1, 'AFTER' => 1, 'BEGIN' => 1, 'BLOCK' => 1, 'BTREE' => 1, 'CACHE' => 1, 'CHAIN' => 1, 'CLOSE' => 1, 'ERROR' => 1, 'EVENT' => 1, 'EVERY' => 1, 'FIRST' => 1, 'FIXED' => 1, 'FLUSH' => 1, 'FOUND' => 1, 'HOSTS' => 1, @@ -187,7 +187,7 @@ class ContextMariaDb100100 extends Context 'ON COMPLETION NOT PRESERVE' => 7, 'BIT' => 9, 'XML' => 9, - 'ENUM' => 9, 'JSON' => 9, 'TEXT' => 9, + 'BOOL' => 9, 'ENUM' => 9, 'JSON' => 9, 'TEXT' => 9, 'ARRAY' => 9, 'SERIAL' => 9, 'BOOLEAN' => 9, diff --git a/src/Contexts/ContextMariaDb100200.php b/src/Contexts/ContextMariaDb100200.php index 9f1ebb299..a97f3ae67 100644 --- a/src/Contexts/ContextMariaDb100200.php +++ b/src/Contexts/ContextMariaDb100200.php @@ -34,12 +34,12 @@ class ContextMariaDb100200 extends Context '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, - 'BOOL' => 1, 'BYTE' => 1, 'CODE' => 1, 'CUBE' => 1, 'DATA' => 1, 'DISK' => 1, - 'ENDS' => 1, 'FAST' => 1, 'FILE' => 1, 'FULL' => 1, 'HASH' => 1, 'HELP' => 1, - 'HOST' => 1, 'LAST' => 1, 'LESS' => 1, 'LIST' => 1, 'LOGS' => 1, 'MODE' => 1, - 'NAME' => 1, 'NEXT' => 1, 'NONE' => 1, 'ONLY' => 1, 'OPEN' => 1, 'PAGE' => 1, - 'PORT' => 1, 'PREV' => 1, 'SLOW' => 1, 'SOME' => 1, 'STOP' => 1, 'THAN' => 1, - 'TYPE' => 1, 'VIEW' => 1, 'WAIT' => 1, 'WORK' => 1, 'X509' => 1, + 'BYTE' => 1, 'CODE' => 1, 'CUBE' => 1, 'DATA' => 1, 'DISK' => 1, 'ENDS' => 1, + 'FAST' => 1, 'FILE' => 1, 'FULL' => 1, 'HASH' => 1, 'HELP' => 1, 'HOST' => 1, + 'LAST' => 1, 'LESS' => 1, 'LIST' => 1, 'LOGS' => 1, 'MODE' => 1, 'NAME' => 1, + 'NEXT' => 1, 'NONE' => 1, 'ONLY' => 1, 'OPEN' => 1, 'PAGE' => 1, 'PORT' => 1, + 'PREV' => 1, 'SLOW' => 1, 'SOME' => 1, 'STOP' => 1, 'THAN' => 1, 'TYPE' => 1, + 'VIEW' => 1, 'WAIT' => 1, 'WORK' => 1, 'X509' => 1, 'AFTER' => 1, 'BEGIN' => 1, 'BLOCK' => 1, 'BTREE' => 1, 'CACHE' => 1, 'CHAIN' => 1, 'CLOSE' => 1, 'ERROR' => 1, 'EVENT' => 1, 'EVERY' => 1, 'FIRST' => 1, 'FIXED' => 1, 'FLUSH' => 1, 'FOUND' => 1, 'HOSTS' => 1, @@ -187,7 +187,7 @@ class ContextMariaDb100200 extends Context 'ON COMPLETION NOT PRESERVE' => 7, 'BIT' => 9, 'XML' => 9, - 'ENUM' => 9, 'JSON' => 9, 'TEXT' => 9, + 'BOOL' => 9, 'ENUM' => 9, 'JSON' => 9, 'TEXT' => 9, 'ARRAY' => 9, 'SERIAL' => 9, 'BOOLEAN' => 9, diff --git a/src/Contexts/ContextMariaDb100300.php b/src/Contexts/ContextMariaDb100300.php index 1d7584300..8d6762a60 100644 --- a/src/Contexts/ContextMariaDb100300.php +++ b/src/Contexts/ContextMariaDb100300.php @@ -34,12 +34,12 @@ class ContextMariaDb100300 extends Context '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, - 'BOOL' => 1, 'BYTE' => 1, 'CODE' => 1, 'CUBE' => 1, 'DATA' => 1, 'DISK' => 1, - 'ENDS' => 1, 'FAST' => 1, 'FILE' => 1, 'FULL' => 1, 'HASH' => 1, 'HELP' => 1, - 'HOST' => 1, 'LAST' => 1, 'LESS' => 1, 'LIST' => 1, 'LOGS' => 1, 'MODE' => 1, - 'NAME' => 1, 'NEXT' => 1, 'NONE' => 1, 'ONLY' => 1, 'OPEN' => 1, 'PAGE' => 1, - 'PORT' => 1, 'PREV' => 1, 'SLOW' => 1, 'SOME' => 1, 'STOP' => 1, 'THAN' => 1, - 'TYPE' => 1, 'VIEW' => 1, 'WAIT' => 1, 'WORK' => 1, 'X509' => 1, + 'BYTE' => 1, 'CODE' => 1, 'CUBE' => 1, 'DATA' => 1, 'DISK' => 1, 'ENDS' => 1, + 'FAST' => 1, 'FILE' => 1, 'FULL' => 1, 'HASH' => 1, 'HELP' => 1, 'HOST' => 1, + 'LAST' => 1, 'LESS' => 1, 'LIST' => 1, 'LOGS' => 1, 'MODE' => 1, 'NAME' => 1, + 'NEXT' => 1, 'NONE' => 1, 'ONLY' => 1, 'OPEN' => 1, 'PAGE' => 1, 'PORT' => 1, + 'PREV' => 1, 'SLOW' => 1, 'SOME' => 1, 'STOP' => 1, 'THAN' => 1, 'TYPE' => 1, + 'VIEW' => 1, 'WAIT' => 1, 'WORK' => 1, 'X509' => 1, 'AFTER' => 1, 'BEGIN' => 1, 'BLOCK' => 1, 'BTREE' => 1, 'CACHE' => 1, 'CHAIN' => 1, 'CLOSE' => 1, 'ERROR' => 1, 'EVENT' => 1, 'EVERY' => 1, 'FIRST' => 1, 'FIXED' => 1, 'FLUSH' => 1, 'FOUND' => 1, 'HOSTS' => 1, @@ -187,7 +187,7 @@ class ContextMariaDb100300 extends Context 'ON COMPLETION NOT PRESERVE' => 7, 'BIT' => 9, 'XML' => 9, - 'ENUM' => 9, 'JSON' => 9, 'TEXT' => 9, + 'BOOL' => 9, 'ENUM' => 9, 'JSON' => 9, 'TEXT' => 9, 'ARRAY' => 9, 'SERIAL' => 9, 'BOOLEAN' => 9, diff --git a/src/Contexts/ContextMariaDb100400.php b/src/Contexts/ContextMariaDb100400.php index 7915c1d2e..7d83076af 100644 --- a/src/Contexts/ContextMariaDb100400.php +++ b/src/Contexts/ContextMariaDb100400.php @@ -34,12 +34,12 @@ class ContextMariaDb100400 extends Context '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, - 'BOOL' => 1, 'BYTE' => 1, 'CODE' => 1, 'CUBE' => 1, 'DATA' => 1, 'DISK' => 1, - 'ENDS' => 1, 'FAST' => 1, 'FILE' => 1, 'FULL' => 1, 'HASH' => 1, 'HELP' => 1, - 'HOST' => 1, 'LAST' => 1, 'LESS' => 1, 'LIST' => 1, 'LOGS' => 1, 'MODE' => 1, - 'NAME' => 1, 'NEXT' => 1, 'NONE' => 1, 'ONLY' => 1, 'OPEN' => 1, 'PAGE' => 1, - 'PORT' => 1, 'PREV' => 1, 'SLOW' => 1, 'SOME' => 1, 'STOP' => 1, 'THAN' => 1, - 'TYPE' => 1, 'VIEW' => 1, 'WAIT' => 1, 'WORK' => 1, 'X509' => 1, + 'BYTE' => 1, 'CODE' => 1, 'CUBE' => 1, 'DATA' => 1, 'DISK' => 1, 'ENDS' => 1, + 'FAST' => 1, 'FILE' => 1, 'FULL' => 1, 'HASH' => 1, 'HELP' => 1, 'HOST' => 1, + 'LAST' => 1, 'LESS' => 1, 'LIST' => 1, 'LOGS' => 1, 'MODE' => 1, 'NAME' => 1, + 'NEXT' => 1, 'NONE' => 1, 'ONLY' => 1, 'OPEN' => 1, 'PAGE' => 1, 'PORT' => 1, + 'PREV' => 1, 'SLOW' => 1, 'SOME' => 1, 'STOP' => 1, 'THAN' => 1, 'TYPE' => 1, + 'VIEW' => 1, 'WAIT' => 1, 'WORK' => 1, 'X509' => 1, 'AFTER' => 1, 'BEGIN' => 1, 'BLOCK' => 1, 'BTREE' => 1, 'CACHE' => 1, 'CHAIN' => 1, 'CLOSE' => 1, 'ERROR' => 1, 'EVENT' => 1, 'EVERY' => 1, 'FIRST' => 1, 'FIXED' => 1, 'FLUSH' => 1, 'FOUND' => 1, 'HOSTS' => 1, @@ -187,7 +187,7 @@ class ContextMariaDb100400 extends Context 'ON COMPLETION NOT PRESERVE' => 7, 'BIT' => 9, 'XML' => 9, - 'ENUM' => 9, 'JSON' => 9, 'TEXT' => 9, + 'BOOL' => 9, 'ENUM' => 9, 'JSON' => 9, 'TEXT' => 9, 'ARRAY' => 9, 'SERIAL' => 9, 'BOOLEAN' => 9, diff --git a/src/Contexts/ContextMariaDb100500.php b/src/Contexts/ContextMariaDb100500.php index 2638962e0..7dd316ea5 100644 --- a/src/Contexts/ContextMariaDb100500.php +++ b/src/Contexts/ContextMariaDb100500.php @@ -34,12 +34,12 @@ class ContextMariaDb100500 extends Context '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, - 'BOOL' => 1, 'BYTE' => 1, 'CODE' => 1, 'CUBE' => 1, 'DATA' => 1, 'DISK' => 1, - 'ENDS' => 1, 'FAST' => 1, 'FILE' => 1, 'FULL' => 1, 'HASH' => 1, 'HELP' => 1, - 'HOST' => 1, 'LAST' => 1, 'LESS' => 1, 'LIST' => 1, 'LOGS' => 1, 'MODE' => 1, - 'NAME' => 1, 'NEXT' => 1, 'NONE' => 1, 'ONLY' => 1, 'OPEN' => 1, 'PAGE' => 1, - 'PORT' => 1, 'PREV' => 1, 'SLOW' => 1, 'SOME' => 1, 'STOP' => 1, 'THAN' => 1, - 'TYPE' => 1, 'VIEW' => 1, 'WAIT' => 1, 'WORK' => 1, 'X509' => 1, + 'BYTE' => 1, 'CODE' => 1, 'CUBE' => 1, 'DATA' => 1, 'DISK' => 1, 'ENDS' => 1, + 'FAST' => 1, 'FILE' => 1, 'FULL' => 1, 'HASH' => 1, 'HELP' => 1, 'HOST' => 1, + 'LAST' => 1, 'LESS' => 1, 'LIST' => 1, 'LOGS' => 1, 'MODE' => 1, 'NAME' => 1, + 'NEXT' => 1, 'NONE' => 1, 'ONLY' => 1, 'OPEN' => 1, 'PAGE' => 1, 'PORT' => 1, + 'PREV' => 1, 'SLOW' => 1, 'SOME' => 1, 'STOP' => 1, 'THAN' => 1, 'TYPE' => 1, + 'VIEW' => 1, 'WAIT' => 1, 'WORK' => 1, 'X509' => 1, 'AFTER' => 1, 'BEGIN' => 1, 'BLOCK' => 1, 'BTREE' => 1, 'CACHE' => 1, 'CHAIN' => 1, 'CLOSE' => 1, 'ERROR' => 1, 'EVENT' => 1, 'EVERY' => 1, 'FIRST' => 1, 'FIXED' => 1, 'FLUSH' => 1, 'FOUND' => 1, 'HOSTS' => 1, @@ -187,7 +187,7 @@ class ContextMariaDb100500 extends Context 'ON COMPLETION NOT PRESERVE' => 7, 'BIT' => 9, 'XML' => 9, - 'ENUM' => 9, 'JSON' => 9, 'TEXT' => 9, + 'BOOL' => 9, 'ENUM' => 9, 'JSON' => 9, 'TEXT' => 9, 'ARRAY' => 9, 'SERIAL' => 9, 'BOOLEAN' => 9, diff --git a/src/Contexts/ContextMariaDb100600.php b/src/Contexts/ContextMariaDb100600.php index c69bbeb7c..3f0b18645 100644 --- a/src/Contexts/ContextMariaDb100600.php +++ b/src/Contexts/ContextMariaDb100600.php @@ -34,12 +34,12 @@ class ContextMariaDb100600 extends Context '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, - 'BOOL' => 1, 'BYTE' => 1, 'CODE' => 1, 'CUBE' => 1, 'DATA' => 1, 'DISK' => 1, - 'ENDS' => 1, 'FAST' => 1, 'FILE' => 1, 'FULL' => 1, 'HASH' => 1, 'HELP' => 1, - 'HOST' => 1, 'LAST' => 1, 'LESS' => 1, 'LIST' => 1, 'LOGS' => 1, 'MODE' => 1, - 'NAME' => 1, 'NEXT' => 1, 'NONE' => 1, 'ONLY' => 1, 'OPEN' => 1, 'PAGE' => 1, - 'PORT' => 1, 'PREV' => 1, 'SLOW' => 1, 'SOME' => 1, 'STOP' => 1, 'THAN' => 1, - 'TYPE' => 1, 'VIEW' => 1, 'WAIT' => 1, 'WORK' => 1, 'X509' => 1, + 'BYTE' => 1, 'CODE' => 1, 'CUBE' => 1, 'DATA' => 1, 'DISK' => 1, 'ENDS' => 1, + 'FAST' => 1, 'FILE' => 1, 'FULL' => 1, 'HASH' => 1, 'HELP' => 1, 'HOST' => 1, + 'LAST' => 1, 'LESS' => 1, 'LIST' => 1, 'LOGS' => 1, 'MODE' => 1, 'NAME' => 1, + 'NEXT' => 1, 'NONE' => 1, 'ONLY' => 1, 'OPEN' => 1, 'PAGE' => 1, 'PORT' => 1, + 'PREV' => 1, 'SLOW' => 1, 'SOME' => 1, 'STOP' => 1, 'THAN' => 1, 'TYPE' => 1, + 'VIEW' => 1, 'WAIT' => 1, 'WORK' => 1, 'X509' => 1, 'AFTER' => 1, 'BEGIN' => 1, 'BLOCK' => 1, 'BTREE' => 1, 'CACHE' => 1, 'CHAIN' => 1, 'CLOSE' => 1, 'ERROR' => 1, 'EVENT' => 1, 'EVERY' => 1, 'FIRST' => 1, 'FIXED' => 1, 'FLUSH' => 1, 'FOUND' => 1, 'HOSTS' => 1, @@ -187,7 +187,7 @@ class ContextMariaDb100600 extends Context 'ON COMPLETION NOT PRESERVE' => 7, 'BIT' => 9, 'XML' => 9, - 'ENUM' => 9, 'JSON' => 9, 'TEXT' => 9, + 'BOOL' => 9, 'ENUM' => 9, 'JSON' => 9, 'TEXT' => 9, 'ARRAY' => 9, 'SERIAL' => 9, 'BOOLEAN' => 9, diff --git a/src/Contexts/ContextMySql50000.php b/src/Contexts/ContextMySql50000.php index 1f0a30cf6..e40ddd404 100644 --- a/src/Contexts/ContextMySql50000.php +++ b/src/Contexts/ContextMySql50000.php @@ -34,11 +34,11 @@ class ContextMySql50000 extends Context '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, - 'BOOL' => 1, 'BYTE' => 1, 'CODE' => 1, 'CUBE' => 1, 'DATA' => 1, 'FAST' => 1, - 'FILE' => 1, 'FULL' => 1, 'HASH' => 1, 'HELP' => 1, 'LAST' => 1, 'LOGS' => 1, - 'MODE' => 1, 'NAME' => 1, 'NEXT' => 1, 'NONE' => 1, 'OPEN' => 1, 'PAGE' => 1, - 'PREV' => 1, 'ROWS' => 1, 'SOME' => 1, 'STOP' => 1, 'TYPE' => 1, 'VIEW' => 1, - 'WORK' => 1, 'X509' => 1, + 'BYTE' => 1, 'CODE' => 1, 'CUBE' => 1, 'DATA' => 1, 'FAST' => 1, 'FILE' => 1, + 'FULL' => 1, 'HASH' => 1, 'HELP' => 1, 'LAST' => 1, 'LOGS' => 1, 'MODE' => 1, + 'NAME' => 1, 'NEXT' => 1, 'NONE' => 1, 'OPEN' => 1, 'PAGE' => 1, 'PREV' => 1, + 'ROWS' => 1, 'SOME' => 1, 'STOP' => 1, 'TYPE' => 1, 'VIEW' => 1, 'WORK' => 1, + 'X509' => 1, 'AFTER' => 1, 'BEGIN' => 1, 'BLOCK' => 1, 'BTREE' => 1, 'CACHE' => 1, 'CHAIN' => 1, 'CLOSE' => 1, 'FIRST' => 1, 'FIXED' => 1, 'FLUSH' => 1, 'FOUND' => 1, 'HOSTS' => 1, 'LEVEL' => 1, 'LOCAL' => 1, 'LOCKS' => 1, @@ -156,7 +156,7 @@ class ContextMySql50000 extends Context 'NATURAL RIGHT OUTER JOIN' => 7, 'WITH CONSISTENT SNAPSHOT' => 7, 'BIT' => 9, 'XML' => 9, - 'ENUM' => 9, 'JSON' => 9, 'TEXT' => 9, + 'BOOL' => 9, 'ENUM' => 9, 'JSON' => 9, 'TEXT' => 9, 'ARRAY' => 9, 'SERIAL' => 9, 'BOOLEAN' => 9, diff --git a/src/Contexts/ContextMySql50100.php b/src/Contexts/ContextMySql50100.php index b1fd587c0..b8b25f457 100644 --- a/src/Contexts/ContextMySql50100.php +++ b/src/Contexts/ContextMySql50100.php @@ -34,12 +34,12 @@ class ContextMySql50100 extends Context '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, - 'BOOL' => 1, 'BYTE' => 1, 'CODE' => 1, 'CUBE' => 1, 'DATA' => 1, 'DISK' => 1, - 'ENDS' => 1, 'FAST' => 1, 'FILE' => 1, 'FULL' => 1, 'GOTO' => 1, 'HASH' => 1, - 'HELP' => 1, 'HOST' => 1, 'LAST' => 1, 'LESS' => 1, 'LIST' => 1, 'LOGS' => 1, - 'MODE' => 1, 'NAME' => 1, 'NEXT' => 1, 'NONE' => 1, 'OPEN' => 1, 'PAGE' => 1, - 'PORT' => 1, 'PREV' => 1, 'ROWS' => 1, 'SOME' => 1, 'STOP' => 1, 'THAN' => 1, - 'TYPE' => 1, 'VIEW' => 1, 'WAIT' => 1, 'WORK' => 1, 'X509' => 1, + 'BYTE' => 1, 'CODE' => 1, 'CUBE' => 1, 'DATA' => 1, 'DISK' => 1, 'ENDS' => 1, + 'FAST' => 1, 'FILE' => 1, 'FULL' => 1, 'GOTO' => 1, 'HASH' => 1, 'HELP' => 1, + 'HOST' => 1, 'LAST' => 1, 'LESS' => 1, 'LIST' => 1, 'LOGS' => 1, 'MODE' => 1, + 'NAME' => 1, 'NEXT' => 1, 'NONE' => 1, 'OPEN' => 1, 'PAGE' => 1, 'PORT' => 1, + 'PREV' => 1, 'ROWS' => 1, 'SOME' => 1, 'STOP' => 1, 'THAN' => 1, 'TYPE' => 1, + 'VIEW' => 1, 'WAIT' => 1, 'WORK' => 1, 'X509' => 1, 'AFTER' => 1, 'BEGIN' => 1, 'BLOCK' => 1, 'BTREE' => 1, 'CACHE' => 1, 'CHAIN' => 1, 'CLOSE' => 1, 'EVENT' => 1, 'EVERY' => 1, 'FIRST' => 1, 'FIXED' => 1, 'FLUSH' => 1, 'FOUND' => 1, 'HOSTS' => 1, 'LABEL' => 1, @@ -171,7 +171,7 @@ class ContextMySql50100 extends Context 'ON COMPLETION NOT PRESERVE' => 7, 'BIT' => 9, 'XML' => 9, - 'ENUM' => 9, 'JSON' => 9, 'TEXT' => 9, + 'BOOL' => 9, 'ENUM' => 9, 'JSON' => 9, 'TEXT' => 9, 'ARRAY' => 9, 'SERIAL' => 9, 'BOOLEAN' => 9, diff --git a/src/Contexts/ContextMySql50500.php b/src/Contexts/ContextMySql50500.php index 66481a143..85c05ee03 100644 --- a/src/Contexts/ContextMySql50500.php +++ b/src/Contexts/ContextMySql50500.php @@ -34,12 +34,12 @@ class ContextMySql50500 extends Context '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, - 'BOOL' => 1, 'BYTE' => 1, 'CODE' => 1, 'CUBE' => 1, 'DATA' => 1, 'DISK' => 1, - 'ENDS' => 1, 'FAST' => 1, 'FILE' => 1, 'FULL' => 1, 'HASH' => 1, 'HELP' => 1, - 'HOST' => 1, 'LAST' => 1, 'LESS' => 1, 'LIST' => 1, 'LOGS' => 1, 'MODE' => 1, - 'NAME' => 1, 'NEXT' => 1, 'NONE' => 1, 'OPEN' => 1, 'PAGE' => 1, 'PORT' => 1, - 'PREV' => 1, 'ROWS' => 1, 'SLOW' => 1, 'SOME' => 1, 'STOP' => 1, 'THAN' => 1, - 'TYPE' => 1, 'VIEW' => 1, 'WAIT' => 1, 'WORK' => 1, 'X509' => 1, + 'BYTE' => 1, 'CODE' => 1, 'CUBE' => 1, 'DATA' => 1, 'DISK' => 1, 'ENDS' => 1, + 'FAST' => 1, 'FILE' => 1, 'FULL' => 1, 'HASH' => 1, 'HELP' => 1, 'HOST' => 1, + 'LAST' => 1, 'LESS' => 1, 'LIST' => 1, 'LOGS' => 1, 'MODE' => 1, 'NAME' => 1, + 'NEXT' => 1, 'NONE' => 1, 'OPEN' => 1, 'PAGE' => 1, 'PORT' => 1, 'PREV' => 1, + 'ROWS' => 1, 'SLOW' => 1, 'SOME' => 1, 'STOP' => 1, 'THAN' => 1, 'TYPE' => 1, + 'VIEW' => 1, 'WAIT' => 1, 'WORK' => 1, 'X509' => 1, 'AFTER' => 1, 'BEGIN' => 1, 'BLOCK' => 1, 'BTREE' => 1, 'CACHE' => 1, 'CHAIN' => 1, 'CLOSE' => 1, 'ERROR' => 1, 'EVENT' => 1, 'EVERY' => 1, 'FIRST' => 1, 'FIXED' => 1, 'FLUSH' => 1, 'FOUND' => 1, 'HOSTS' => 1, @@ -176,7 +176,7 @@ class ContextMySql50500 extends Context 'ON COMPLETION NOT PRESERVE' => 7, 'BIT' => 9, 'XML' => 9, - 'ENUM' => 9, 'JSON' => 9, 'TEXT' => 9, + 'BOOL' => 9, 'ENUM' => 9, 'JSON' => 9, 'TEXT' => 9, 'ARRAY' => 9, 'SERIAL' => 9, 'BOOLEAN' => 9, diff --git a/src/Contexts/ContextMySql50600.php b/src/Contexts/ContextMySql50600.php index 312e276de..1b4d8327e 100644 --- a/src/Contexts/ContextMySql50600.php +++ b/src/Contexts/ContextMySql50600.php @@ -34,12 +34,12 @@ class ContextMySql50600 extends Context '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, - 'BOOL' => 1, 'BYTE' => 1, 'CODE' => 1, 'CUBE' => 1, 'DATA' => 1, 'DISK' => 1, - 'ENDS' => 1, 'FAST' => 1, 'FILE' => 1, 'FULL' => 1, 'HASH' => 1, 'HELP' => 1, - 'HOST' => 1, 'LAST' => 1, 'LESS' => 1, 'LIST' => 1, 'LOGS' => 1, 'MODE' => 1, - 'NAME' => 1, 'NEXT' => 1, 'NONE' => 1, 'ONLY' => 1, 'OPEN' => 1, 'PAGE' => 1, - 'PORT' => 1, 'PREV' => 1, 'ROWS' => 1, 'SLOW' => 1, 'SOME' => 1, 'STOP' => 1, - 'THAN' => 1, 'TYPE' => 1, 'VIEW' => 1, 'WAIT' => 1, 'WORK' => 1, 'X509' => 1, + 'BYTE' => 1, 'CODE' => 1, 'CUBE' => 1, 'DATA' => 1, 'DISK' => 1, 'ENDS' => 1, + 'FAST' => 1, 'FILE' => 1, 'FULL' => 1, 'HASH' => 1, 'HELP' => 1, 'HOST' => 1, + 'LAST' => 1, 'LESS' => 1, 'LIST' => 1, 'LOGS' => 1, 'MODE' => 1, 'NAME' => 1, + 'NEXT' => 1, 'NONE' => 1, 'ONLY' => 1, 'OPEN' => 1, 'PAGE' => 1, 'PORT' => 1, + 'PREV' => 1, 'ROWS' => 1, 'SLOW' => 1, 'SOME' => 1, 'STOP' => 1, 'THAN' => 1, + 'TYPE' => 1, 'VIEW' => 1, 'WAIT' => 1, 'WORK' => 1, 'X509' => 1, 'AFTER' => 1, 'BEGIN' => 1, 'BLOCK' => 1, 'BTREE' => 1, 'CACHE' => 1, 'CHAIN' => 1, 'CLOSE' => 1, 'ERROR' => 1, 'EVENT' => 1, 'EVERY' => 1, 'FIRST' => 1, 'FIXED' => 1, 'FLUSH' => 1, 'FOUND' => 1, 'HOSTS' => 1, @@ -181,7 +181,7 @@ class ContextMySql50600 extends Context 'ON COMPLETION NOT PRESERVE' => 7, 'BIT' => 9, 'XML' => 9, - 'ENUM' => 9, 'JSON' => 9, 'TEXT' => 9, + 'BOOL' => 9, 'ENUM' => 9, 'JSON' => 9, 'TEXT' => 9, 'ARRAY' => 9, 'SERIAL' => 9, 'BOOLEAN' => 9, diff --git a/src/Contexts/ContextMySql50700.php b/src/Contexts/ContextMySql50700.php index 853df65da..4bf1a9c90 100644 --- a/src/Contexts/ContextMySql50700.php +++ b/src/Contexts/ContextMySql50700.php @@ -34,12 +34,12 @@ class ContextMySql50700 extends Context '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, - 'BOOL' => 1, 'BYTE' => 1, 'CODE' => 1, 'CUBE' => 1, 'DATA' => 1, 'DISK' => 1, - 'ENDS' => 1, 'FAST' => 1, 'FILE' => 1, 'FULL' => 1, 'HASH' => 1, 'HELP' => 1, - 'HOST' => 1, 'LAST' => 1, 'LESS' => 1, 'LIST' => 1, 'LOGS' => 1, 'MODE' => 1, - 'NAME' => 1, 'NEXT' => 1, 'NONE' => 1, 'ONLY' => 1, 'OPEN' => 1, 'PAGE' => 1, - 'PORT' => 1, 'PREV' => 1, 'ROWS' => 1, 'SLOW' => 1, 'SOME' => 1, 'STOP' => 1, - 'THAN' => 1, 'TYPE' => 1, 'VIEW' => 1, 'WAIT' => 1, 'WORK' => 1, 'X509' => 1, + 'BYTE' => 1, 'CODE' => 1, 'CUBE' => 1, 'DATA' => 1, 'DISK' => 1, 'ENDS' => 1, + 'FAST' => 1, 'FILE' => 1, 'FULL' => 1, 'HASH' => 1, 'HELP' => 1, 'HOST' => 1, + 'LAST' => 1, 'LESS' => 1, 'LIST' => 1, 'LOGS' => 1, 'MODE' => 1, 'NAME' => 1, + 'NEXT' => 1, 'NONE' => 1, 'ONLY' => 1, 'OPEN' => 1, 'PAGE' => 1, 'PORT' => 1, + 'PREV' => 1, 'ROWS' => 1, 'SLOW' => 1, 'SOME' => 1, 'STOP' => 1, 'THAN' => 1, + 'TYPE' => 1, 'VIEW' => 1, 'WAIT' => 1, 'WORK' => 1, 'X509' => 1, 'AFTER' => 1, 'BEGIN' => 1, 'BLOCK' => 1, 'BTREE' => 1, 'CACHE' => 1, 'CHAIN' => 1, 'CLOSE' => 1, 'ERROR' => 1, 'EVENT' => 1, 'EVERY' => 1, 'FIRST' => 1, 'FIXED' => 1, 'FLUSH' => 1, 'FOUND' => 1, 'HOSTS' => 1, @@ -187,7 +187,7 @@ class ContextMySql50700 extends Context 'ON COMPLETION NOT PRESERVE' => 7, 'BIT' => 9, 'XML' => 9, - 'ENUM' => 9, 'JSON' => 9, 'TEXT' => 9, + 'BOOL' => 9, 'ENUM' => 9, 'JSON' => 9, 'TEXT' => 9, 'ARRAY' => 9, 'SERIAL' => 9, 'BOOLEAN' => 9, diff --git a/src/Contexts/ContextMySql80000.php b/src/Contexts/ContextMySql80000.php index f21953333..2f6e5a90d 100644 --- a/src/Contexts/ContextMySql80000.php +++ b/src/Contexts/ContextMySql80000.php @@ -34,12 +34,12 @@ class ContextMySql80000 extends Context '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, - 'BOOL' => 1, 'BYTE' => 1, 'CODE' => 1, 'CUBE' => 1, 'DATA' => 1, 'DISK' => 1, - 'ENDS' => 1, 'FAST' => 1, 'FILE' => 1, 'FULL' => 1, 'HASH' => 1, 'HELP' => 1, - 'HOST' => 1, 'LAST' => 1, 'LESS' => 1, 'LIST' => 1, 'LOGS' => 1, 'MODE' => 1, - 'NAME' => 1, 'NEXT' => 1, 'NONE' => 1, 'ONLY' => 1, 'OPEN' => 1, 'PAGE' => 1, - 'PORT' => 1, 'PREV' => 1, 'ROWS' => 1, 'SLOW' => 1, 'SOME' => 1, 'STOP' => 1, - 'THAN' => 1, 'TYPE' => 1, 'VIEW' => 1, 'WAIT' => 1, 'WORK' => 1, 'X509' => 1, + 'BYTE' => 1, 'CODE' => 1, 'CUBE' => 1, 'DATA' => 1, 'DISK' => 1, 'ENDS' => 1, + 'FAST' => 1, 'FILE' => 1, 'FULL' => 1, 'HASH' => 1, 'HELP' => 1, 'HOST' => 1, + 'LAST' => 1, 'LESS' => 1, 'LIST' => 1, 'LOGS' => 1, 'MODE' => 1, 'NAME' => 1, + 'NEXT' => 1, 'NONE' => 1, 'ONLY' => 1, 'OPEN' => 1, 'PAGE' => 1, 'PORT' => 1, + 'PREV' => 1, 'ROWS' => 1, 'SLOW' => 1, 'SOME' => 1, 'STOP' => 1, 'THAN' => 1, + 'TYPE' => 1, 'VIEW' => 1, 'WAIT' => 1, 'WORK' => 1, 'X509' => 1, 'AFTER' => 1, 'BEGIN' => 1, 'BLOCK' => 1, 'BTREE' => 1, 'CACHE' => 1, 'CHAIN' => 1, 'CLOSE' => 1, 'ERROR' => 1, 'EVENT' => 1, 'EVERY' => 1, 'FIRST' => 1, 'FIXED' => 1, 'FLUSH' => 1, 'FOUND' => 1, 'HOSTS' => 1, @@ -188,7 +188,7 @@ class ContextMySql80000 extends Context 'ON COMPLETION NOT PRESERVE' => 7, 'BIT' => 9, 'XML' => 9, - 'ENUM' => 9, 'JSON' => 9, 'TEXT' => 9, + 'BOOL' => 9, 'ENUM' => 9, 'JSON' => 9, 'TEXT' => 9, 'ARRAY' => 9, 'SERIAL' => 9, 'BOOLEAN' => 9, diff --git a/src/Core.php b/src/Core.php index ffa8bc429..775b686ac 100644 --- a/src/Core.php +++ b/src/Core.php @@ -47,11 +47,9 @@ public function __construct() * * @param Exception $error the error exception * - * @return void - * * @throws Exception throws the exception, if strict mode is enabled. */ - public function error($error) + public function error($error): void { if ($this->strict) { throw $error; diff --git a/src/Lexer.php b/src/Lexer.php index 98a24231a..483215257 100644 --- a/src/Lexer.php +++ b/src/Lexer.php @@ -158,10 +158,8 @@ class Lexer extends Core * @param bool $strict whether strict mode should be * enabled or not * @param string $delimiter the delimiter to be used - * - * @return TokensList */ - public static function getTokens($str, $strict = false, $delimiter = null) + public static function getTokens($str, $strict = false, $delimiter = null): TokensList { $lexer = new self($str, $strict, $delimiter); @@ -456,10 +454,8 @@ public function error($msg, $str = '', $pos = 0, $code = 0): void /** * Parses a keyword. - * - * @return Token|null */ - public function parseKeyword() + public function parseKeyword(): Token|null { $token = ''; @@ -518,10 +514,8 @@ public function parseKeyword() /** * Parses a label. - * - * @return Token|null */ - public function parseLabel() + public function parseLabel(): Token|null { $token = ''; @@ -564,10 +558,8 @@ public function parseLabel() /** * Parses an operator. - * - * @return Token|null */ - public function parseOperator() + public function parseOperator(): Token|null { $token = ''; @@ -602,10 +594,8 @@ public function parseOperator() /** * Parses a whitespace. - * - * @return Token|null */ - public function parseWhitespace() + public function parseWhitespace(): Token|null { $token = $this->str[$this->last]; @@ -624,10 +614,8 @@ public function parseWhitespace() /** * Parses a comment. - * - * @return Token|null */ - public function parseComment() + public function parseComment(): Token|null { $iBak = $this->last; $token = $this->str[$this->last]; @@ -743,10 +731,8 @@ public function parseComment() /** * Parses a boolean. - * - * @return Token|null */ - public function parseBool() + public function parseBool(): Token|null { if ($this->last + 3 >= $this->len) { // At least `min(strlen('TRUE'), strlen('FALSE'))` characters are @@ -776,10 +762,8 @@ public function parseBool() /** * Parses a number. - * - * @return Token|null */ - public function parseNumber() + public function parseNumber(): Token|null { // A rudimentary state machine is being used to parse numbers due to // the various forms of their notation. @@ -829,10 +813,7 @@ public function parseNumber() } elseif ( $this->last + 1 < $this->len && $this->str[$this->last] === '0' - && ( - $this->str[$this->last + 1] === 'x' - || $this->str[$this->last + 1] === 'X' - ) + && $this->str[$this->last + 1] === 'x' ) { $token .= $this->str[$this->last++]; $state = 2; @@ -943,11 +924,9 @@ public function parseNumber() * * @param string $quote additional starting symbol * - * @return Token|null - * * @throws LexerException */ - public function parseString($quote = '') + public function parseString($quote = ''): Token|null { $token = $this->str[$this->last]; $flags = Context::isString($token); @@ -995,11 +974,9 @@ public function parseString($quote = '') /** * Parses a symbol. * - * @return Token|null - * * @throws LexerException */ - public function parseSymbol() + public function parseSymbol(): Token|null { $token = $this->str[$this->last]; $flags = Context::isSymbol($token); @@ -1045,10 +1022,8 @@ public function parseSymbol() /** * Parses unknown parts of the query. - * - * @return Token|null */ - public function parseUnknown() + public function parseUnknown(): Token|null { $token = $this->str[$this->last]; if (Context::isSeparator($token)) { @@ -1073,10 +1048,8 @@ public function parseUnknown() /** * Parses the delimiter of the query. - * - * @return Token|null */ - public function parseDelimiter() + public function parseDelimiter(): Token|null { $idx = 0; diff --git a/src/Statement.php b/src/Statement.php index 1bf36f5e8..9f75c60e6 100644 --- a/src/Statement.php +++ b/src/Statement.php @@ -454,10 +454,8 @@ public function getClauses(): array * Builds the string representation of this statement. * * @see static::build - * - * @return string */ - public function __toString() + public function __toString(): string { return $this->build(); } diff --git a/src/Statements/AlterStatement.php b/src/Statements/AlterStatement.php index 12c98aeb1..1a9b6f07a 100644 --- a/src/Statements/AlterStatement.php +++ b/src/Statements/AlterStatement.php @@ -67,7 +67,14 @@ class AlterStatement extends Statement public function parse(Parser $parser, TokensList $list): void { ++$list->idx; // Skipping `ALTER`. - $this->options = OptionsArray::parse($parser, $list, static::$statementOptions); + $parsedOptions = OptionsArray::parse($parser, $list, static::$statementOptions); + if ($parsedOptions->isEmpty()) { + $parser->error('Unrecognized alter operation.', $list->tokens[$list->idx]); + + return; + } + + $this->options = $parsedOptions; ++$list->idx; // Parsing affected table. diff --git a/src/Statements/LoadStatement.php b/src/Statements/LoadStatement.php index 68b69bc53..88f37d933 100644 --- a/src/Statements/LoadStatement.php +++ b/src/Statements/LoadStatement.php @@ -336,10 +336,8 @@ public function parseFileOptions(Parser $parser, TokensList $list, $keyword = 'F * @param Parser $parser * @param TokensList $list * @param int $state - * - * @return int */ - public function parseKeywordsAccordingToState($parser, $list, $state) + public function parseKeywordsAccordingToState($parser, $list, $state): int { $token = $list->tokens[$list->idx]; diff --git a/src/Statements/PurgeStatement.php b/src/Statements/PurgeStatement.php index b8302cdbe..10cf6b31b 100644 --- a/src/Statements/PurgeStatement.php +++ b/src/Statements/PurgeStatement.php @@ -122,10 +122,8 @@ public function parse(Parser $parser, TokensList $list): void * @param Parser $parser the instance that requests parsing * @param Token $token token to be parsed * @param string[] $expectedKeywords array of possibly expected keywords at this point - * - * @return mixed|null */ - private static function parseExpectedKeyword($parser, $token, $expectedKeywords) + private static function parseExpectedKeyword($parser, $token, $expectedKeywords): mixed { if ($token->type === Token::TYPE_KEYWORD) { if (in_array($token->keyword, $expectedKeywords)) { diff --git a/src/Statements/WithStatement.php b/src/Statements/WithStatement.php index b08e71a62..4b0469d73 100644 --- a/src/Statements/WithStatement.php +++ b/src/Statements/WithStatement.php @@ -15,6 +15,7 @@ use PhpMyAdmin\SqlParser\Translator; use function array_slice; +use function preg_match; /** * `WITH` statement. @@ -111,7 +112,7 @@ public function parse(Parser $parser, TokensList $list): void } if ($state === 0) { - if ($token->type !== Token::TYPE_NONE) { + if ($token->type !== Token::TYPE_NONE || ! preg_match('/^[a-zA-Z0-9_$]+$/', $token->token)) { $parser->error('The name of the CTE was expected.', $token); break; } @@ -121,7 +122,12 @@ public function parse(Parser $parser, TokensList $list): void $state = 1; } elseif ($state === 1) { if ($token->type === Token::TYPE_OPERATOR && $token->value === '(') { - $this->withers[$wither]->columns = Array2d::parse($parser, $list); + $columns = Array2d::parse($parser, $list); + if ($parser->errors !== []) { + break; + } + + $this->withers[$wither]->columns = $columns; $state = 2; } elseif ($token->type === Token::TYPE_KEYWORD && $token->keyword === 'AS') { $state = 3; diff --git a/src/Token.php b/src/Token.php index 27b0f6371..1a5be3c53 100644 --- a/src/Token.php +++ b/src/Token.php @@ -228,10 +228,8 @@ public function __construct($token, $type = 0, $flags = 0) * Does little processing to the token to extract a value. * * If no processing can be done it will return the initial string. - * - * @return mixed */ - public function extract() + public function extract(): mixed { switch ($this->type) { case self::TYPE_KEYWORD: @@ -253,8 +251,8 @@ public function extract() case self::TYPE_NUMBER: $ret = str_replace('--', '', $this->token); // e.g. ---42 === -42 if ($this->flags & self::FLAG_NUMBER_HEX) { + $ret = str_replace(['-', '+'], '', $this->token); if ($this->flags & self::FLAG_NUMBER_NEGATIVE) { - $ret = str_replace('-', '', $this->token); $ret = -hexdec($ret); } else { $ret = hexdec($ret); diff --git a/src/TokensList.php b/src/TokensList.php index 39af9204b..d669bda4c 100644 --- a/src/TokensList.php +++ b/src/TokensList.php @@ -93,10 +93,8 @@ public function add(Token $token): void /** * Gets the next token. Skips any irrelevant token (whitespaces and * comments). - * - * @return Token|null */ - public function getNext() + public function getNext(): Token|null { for (; $this->idx < $this->count; ++$this->idx) { if ( @@ -132,10 +130,8 @@ public function getPrevious(): Token|null * Gets the previous token. * * @param int|int[] $type the type - * - * @return Token|null */ - public function getPreviousOfType($type) + public function getPreviousOfType($type): Token|null { if (! is_array($type)) { $type = [$type]; @@ -154,10 +150,8 @@ public function getPreviousOfType($type) * Gets the next token. * * @param int|int[] $type the type - * - * @return Token|null */ - public function getNextOfType($type) + public function getNextOfType($type): Token|null { if (! is_array($type)) { $type = [$type]; @@ -177,10 +171,8 @@ public function getNextOfType($type) * * @param int $type the type of the token * @param string $value the value of the token - * - * @return Token|null */ - public function getNextOfTypeAndValue($type, $value) + public function getNextOfTypeAndValue($type, $value): Token|null { for (; $this->idx < $this->count; ++$this->idx) { if (($this->tokens[$this->idx]->type === $type) && ($this->tokens[$this->idx]->value === $value)) { diff --git a/src/Tools/ContextGenerator.php b/src/Tools/ContextGenerator.php index db385cad9..3fbe7c9f5 100644 --- a/src/Tools/ContextGenerator.php +++ b/src/Tools/ContextGenerator.php @@ -145,7 +145,7 @@ public static function sortWords(array &$arr): array * * @return array>> */ - public static function readWords(array $files) + public static function readWords(array $files): array { $words = []; foreach ($files as $file) { @@ -279,10 +279,8 @@ public static function generate($options): string * Formats context name. * * @param string $name name to format - * - * @return string */ - public static function formatName($name) + public static function formatName($name): string { /* Split name and version */ $parts = []; diff --git a/src/Tools/TestGenerator.php b/src/Tools/TestGenerator.php index d64da4423..2056deb00 100644 --- a/src/Tools/TestGenerator.php +++ b/src/Tools/TestGenerator.php @@ -132,10 +132,8 @@ public static function generate($query, $type = 'parser'): array * @param string $output the output file * @param string $debug the debug file * @param bool $ansi activate quotes ANSI mode - * - * @return void */ - public static function build($type, $input, $output, $debug = null, $ansi = false) + public static function build($type, $input, $output, $debug = null, $ansi = false): void { // Support query types: `lexer` / `parser`. if (! in_array($type, ['lexer', 'parser'])) { diff --git a/src/Translator.php b/src/Translator.php index b4876a462..f693bb9a9 100644 --- a/src/Translator.php +++ b/src/Translator.php @@ -63,7 +63,7 @@ public static function load(): void * * @return string translated string (or original, if not found) */ - public static function gettext($msgid) + public static function gettext($msgid): string { if (! class_exists(Loader::class, true)) { return $msgid; diff --git a/src/UtfString.php b/src/UtfString.php index 59d2f436f..e2aa00b69 100644 --- a/src/UtfString.php +++ b/src/UtfString.php @@ -318,20 +318,16 @@ public static function getCharLength($byte): int /** * Returns the length in characters of the string. - * - * @return int */ - public function length() + public function length(): int { return $this->charLen; } /** * Returns the contained string. - * - * @return string */ - public function __toString() + public function __toString(): string { return $this->str; } diff --git a/src/Utils/BufferedQuery.php b/src/Utils/BufferedQuery.php index c12155b69..5be54ed21 100644 --- a/src/Utils/BufferedQuery.php +++ b/src/Utils/BufferedQuery.php @@ -120,10 +120,8 @@ public function setDelimiter($delimiter): void * Extracts a statement from the buffer. * * @param bool $end whether the end of the buffer was reached - * - * @return string|false */ - public function extract($end = false) + public function extract($end = false): string|false { /** * The last parsed position. diff --git a/src/Utils/Formatter.php b/src/Utils/Formatter.php index 3f1238383..f5227a808 100644 --- a/src/Utils/Formatter.php +++ b/src/Utils/Formatter.php @@ -92,7 +92,7 @@ public function __construct(array $options = []) * * @return array>> */ - protected function getMergedOptions(array $options) + protected function getMergedOptions(array $options): array { $options = array_merge( $this->getDefaultOptions(), @@ -324,10 +324,8 @@ private static function mergeFormats(array $formats, array $newFormats): array * Formats the given list of tokens. * * @param TokensList $list the list of tokens - * - * @return string */ - public function formatList($list) + public function formatList($list): string { /** * The query to be returned. @@ -636,10 +634,8 @@ public function escapeConsole(string $string): string * Tries to print the query and returns the result. * * @param Token $token the token to be printed - * - * @return string */ - public function toString($token) + public function toString($token): string { $text = $token->token; static $prev; @@ -698,7 +694,7 @@ public function toString($token) * * @return string the formatted string */ - public static function format($query, array $options = []) + public static function format($query, array $options = []): string { $lexer = new Lexer($query); $formatter = new self($options); @@ -712,10 +708,8 @@ public static function format($query, array $options = []) * A group is delimited by a pair of brackets. * * @param TokensList $list the list of tokens - * - * @return int */ - public static function getGroupLength($list) + public static function getGroupLength($list): int { /** * The number of opening brackets found. diff --git a/src/Utils/Query.php b/src/Utils/Query.php index a3e8b283a..eda62a430 100644 --- a/src/Utils/Query.php +++ b/src/Utils/Query.php @@ -286,7 +286,7 @@ class Query * @return array * @psalm-return QueryFlagsType */ - private static function getFlagsSelect(SelectStatement $statement, $flags) + private static function getFlagsSelect(SelectStatement $statement, $flags): array { $flags['querytype'] = 'SELECT'; $flags['is_select'] = true; @@ -362,7 +362,7 @@ private static function getFlagsSelect(SelectStatement $statement, $flags) * @return array * @psalm-return QueryFlagsType */ - public static function getFlags($statement, $all = false) + public static function getFlags($statement, $all = false): array { $flags = ['querytype' => false]; if ($all) { @@ -469,7 +469,7 @@ public static function getFlags($statement, $all = false) * statement?: Statement|null, parser?: Parser * } */ - public static function getAll($query) + public static function getAll($query): array { $parser = new Parser($query); @@ -557,7 +557,7 @@ public static function getAll($query) * * @return array */ - public static function getTables($statement) + public static function getTables($statement): array { $expressions = []; @@ -881,10 +881,8 @@ public static function getFirstStatement($query, $delimiter = null): array * @param Statement $statement the parsed query that has to be modified * @param TokensList $list the list of tokens * @param string $clause the clause to be returned - * - * @return int */ - public static function getClauseStartOffset($statement, $list, $clause) + public static function getClauseStartOffset($statement, $list, $clause): int { /** * The count of brackets. diff --git a/src/Utils/Table.php b/src/Utils/Table.php index 7bca9fd8e..fe4082543 100644 --- a/src/Utils/Table.php +++ b/src/Utils/Table.php @@ -21,7 +21,7 @@ class Table * * @return array> */ - public static function getForeignKeys($statement) + public static function getForeignKeys($statement): array { if (empty($statement->fields) || (! is_array($statement->fields)) || (! $statement->options->has('TABLE'))) { return []; @@ -79,7 +79,7 @@ public static function getForeignKeys($statement) * * @return array> */ - public static function getFields($statement) + public static function getFields($statement): array { if (empty($statement->fields) || (! is_array($statement->fields)) || (! $statement->options->has('TABLE'))) { return []; diff --git a/tests/Lexer/ContextTest.php b/tests/Lexer/ContextTest.php index b02d1180c..95ba7b57f 100644 --- a/tests/Lexer/ContextTest.php +++ b/tests/Lexer/ContextTest.php @@ -217,6 +217,10 @@ public function testEscape(): void { Context::setMode(Context::SQL_MODE_NO_ENCLOSING_QUOTES); $this->assertEquals('test', Context::escape('test')); + $this->assertEquals('`123`', Context::escape('123')); + $this->assertEquals('`$test`', Context::escape('$test')); + $this->assertEquals('`te st`', Context::escape('te st')); + $this->assertEquals('`te.st`', Context::escape('te.st')); Context::setMode(Context::SQL_MODE_ANSI_QUOTES); $this->assertEquals('"test"', Context::escape('test')); diff --git a/tests/Misc/BugsTest.php b/tests/Misc/BugsTest.php index bc3a50e09..a0176d321 100644 --- a/tests/Misc/BugsTest.php +++ b/tests/Misc/BugsTest.php @@ -21,10 +21,15 @@ public function testBug(string $test): void public static function bugProvider(): array { return [ + ['bugs/fuzz1'], + ['bugs/fuzz2'], + ['bugs/fuzz3'], + ['bugs/fuzz4'], ['bugs/gh9'], ['bugs/gh14'], ['bugs/gh16'], ['bugs/gh317'], + ['bugs/gh508'], ['bugs/pma11800'], ['bugs/pma11836'], ['bugs/pma11843'], diff --git a/tests/data/bugs/fuzz1.in b/tests/data/bugs/fuzz1.in new file mode 100644 index 000000000..406cde8e3 --- /dev/null +++ b/tests/data/bugs/fuzz1.in @@ -0,0 +1 @@ +ALTER..2 \ No newline at end of file diff --git a/tests/data/bugs/fuzz1.out b/tests/data/bugs/fuzz1.out new file mode 100644 index 000000000..c7a03aba8 --- /dev/null +++ b/tests/data/bugs/fuzz1.out @@ -0,0 +1,94 @@ +{ + "query": "ALTER..2", + "lexer": { + "@type": "PhpMyAdmin\\SqlParser\\Lexer", + "str": "ALTER..2", + "len": 8, + "last": 8, + "list": { + "@type": "PhpMyAdmin\\SqlParser\\TokensList", + "tokens": [ + { + "@type": "PhpMyAdmin\\SqlParser\\Token", + "token": "ALTER", + "value": "ALTER", + "keyword": "ALTER", + "type": 1, + "flags": 3, + "position": 0 + }, + { + "@type": "PhpMyAdmin\\SqlParser\\Token", + "token": ".", + "value": ".", + "keyword": null, + "type": 2, + "flags": 16, + "position": 5 + }, + { + "@type": "PhpMyAdmin\\SqlParser\\Token", + "token": ".2", + "value": 0.2, + "keyword": null, + "type": 6, + "flags": 2, + "position": 6 + }, + { + "@type": "PhpMyAdmin\\SqlParser\\Token", + "token": null, + "value": null, + "keyword": null, + "type": 9, + "flags": 0, + "position": null + } + ], + "count": 4, + "idx": 4 + }, + "delimiter": ";", + "delimiterLen": 1, + "strict": false, + "errors": [] + }, + "parser": { + "@type": "PhpMyAdmin\\SqlParser\\Parser", + "list": { + "@type": "@1" + }, + "statements": [ + { + "@type": "PhpMyAdmin\\SqlParser\\Statements\\AlterStatement", + "table": null, + "altered": [], + "options": null, + "first": 0, + "last": 0 + } + ], + "brackets": 0, + "strict": false, + "errors": [] + }, + "errors": { + "lexer": [], + "parser": [ + [ + "Unrecognized alter operation.", + { + "@type": "@2" + }, + 0 + ], + [ + "Unexpected beginning of statement.", + { + "@type": "@4" + }, + 0 + ] + ] + } +} \ No newline at end of file diff --git a/tests/data/bugs/fuzz2.in b/tests/data/bugs/fuzz2.in new file mode 100644 index 000000000..bda1ec626 --- /dev/null +++ b/tests/data/bugs/fuzz2.in @@ -0,0 +1 @@ +WITH]( \ No newline at end of file diff --git a/tests/data/bugs/fuzz2.out b/tests/data/bugs/fuzz2.out new file mode 100644 index 000000000..335ea320f --- /dev/null +++ b/tests/data/bugs/fuzz2.out @@ -0,0 +1,111 @@ +{ + "query": "WITH](", + "lexer": { + "@type": "PhpMyAdmin\\SqlParser\\Lexer", + "str": "WITH](", + "len": 6, + "last": 6, + "list": { + "@type": "PhpMyAdmin\\SqlParser\\TokensList", + "tokens": [ + { + "@type": "PhpMyAdmin\\SqlParser\\Token", + "token": "WITH", + "value": "WITH", + "keyword": "WITH", + "type": 1, + "flags": 3, + "position": 0 + }, + { + "@type": "PhpMyAdmin\\SqlParser\\Token", + "token": "]", + "value": "]", + "keyword": null, + "type": 0, + "flags": 0, + "position": 4 + }, + { + "@type": "PhpMyAdmin\\SqlParser\\Token", + "token": "(", + "value": "(", + "keyword": null, + "type": 2, + "flags": 16, + "position": 5 + }, + { + "@type": "PhpMyAdmin\\SqlParser\\Token", + "token": null, + "value": null, + "keyword": null, + "type": 9, + "flags": 0, + "position": null + } + ], + "count": 4, + "idx": 4 + }, + "delimiter": ";", + "delimiterLen": 1, + "strict": false, + "errors": [] + }, + "parser": { + "@type": "PhpMyAdmin\\SqlParser\\Parser", + "list": { + "@type": "@1" + }, + "statements": [ + { + "@type": "PhpMyAdmin\\SqlParser\\Statements\\WithStatement", + "withers": [], + "cteStatementParser": null, + "options": { + "@type": "PhpMyAdmin\\SqlParser\\Components\\OptionsArray", + "options": [] + }, + "first": 0, + "last": 0 + } + ], + "brackets": 1, + "strict": false, + "errors": [] + }, + "errors": { + "lexer": [ + [ + "Unexpected character.", + "]", + 4, + 0 + ] + ], + "parser": [ + [ + "The name of the CTE was expected.", + { + "@type": "@3" + }, + 0 + ], + [ + "Unexpected end of the WITH CTE.", + { + "@type": "@3" + }, + 0 + ], + [ + "Unexpected beginning of statement.", + { + "@type": "@3" + }, + 0 + ] + ] + } +} \ No newline at end of file diff --git a/tests/data/bugs/fuzz3.in b/tests/data/bugs/fuzz3.in new file mode 100644 index 000000000..48d31fa9b --- /dev/null +++ b/tests/data/bugs/fuzz3.in @@ -0,0 +1 @@ +WITH*/A( \ No newline at end of file diff --git a/tests/data/bugs/fuzz3.out b/tests/data/bugs/fuzz3.out new file mode 100644 index 000000000..6b9ee9903 --- /dev/null +++ b/tests/data/bugs/fuzz3.out @@ -0,0 +1,113 @@ +{ + "query": "WITH*/A(", + "lexer": { + "@type": "PhpMyAdmin\\SqlParser\\Lexer", + "str": "WITH*/A(", + "len": 8, + "last": 8, + "list": { + "@type": "PhpMyAdmin\\SqlParser\\TokensList", + "tokens": [ + { + "@type": "PhpMyAdmin\\SqlParser\\Token", + "token": "WITH", + "value": "WITH", + "keyword": "WITH", + "type": 1, + "flags": 3, + "position": 0 + }, + { + "@type": "PhpMyAdmin\\SqlParser\\Token", + "token": "*/", + "value": "*/", + "keyword": null, + "type": 4, + "flags": 2, + "position": 4 + }, + { + "@type": "PhpMyAdmin\\SqlParser\\Token", + "token": "A", + "value": "A", + "keyword": null, + "type": 0, + "flags": 0, + "position": 6 + }, + { + "@type": "PhpMyAdmin\\SqlParser\\Token", + "token": "(", + "value": "(", + "keyword": null, + "type": 2, + "flags": 16, + "position": 7 + }, + { + "@type": "PhpMyAdmin\\SqlParser\\Token", + "token": null, + "value": null, + "keyword": null, + "type": 9, + "flags": 0, + "position": null + } + ], + "count": 5, + "idx": 5 + }, + "delimiter": ";", + "delimiterLen": 1, + "strict": false, + "errors": [] + }, + "parser": { + "@type": "PhpMyAdmin\\SqlParser\\Parser", + "list": { + "@type": "@1" + }, + "statements": [ + { + "@type": "PhpMyAdmin\\SqlParser\\Statements\\WithStatement", + "withers": { + "A": { + "@type": "PhpMyAdmin\\SqlParser\\Components\\WithKeyword", + "name": "A", + "columns": [], + "statement": null + } + }, + "cteStatementParser": null, + "options": { + "@type": "PhpMyAdmin\\SqlParser\\Components\\OptionsArray", + "options": [] + }, + "first": 0, + "last": 3 + } + ], + "brackets": 0, + "strict": false, + "errors": [] + }, + "errors": { + "lexer": [], + "parser": [ + [ + "A closing bracket was expected.", + { + "@type": "@6" + }, + 0 + ], + [ + "Unexpected end of the WITH CTE.", + { + "@type": "@6" + }, + 0 + ] + ] + } +} \ No newline at end of file diff --git a/tests/data/bugs/fuzz4.in b/tests/data/bugs/fuzz4.in new file mode 100644 index 000000000..c688c143f --- /dev/null +++ b/tests/data/bugs/fuzz4.in @@ -0,0 +1 @@ +ALTeR=SET \ No newline at end of file diff --git a/tests/data/bugs/fuzz4.out b/tests/data/bugs/fuzz4.out new file mode 100644 index 000000000..cb0782d08 --- /dev/null +++ b/tests/data/bugs/fuzz4.out @@ -0,0 +1,98 @@ +{ + "query": "ALTeR=SET", + "lexer": { + "@type": "PhpMyAdmin\\SqlParser\\Lexer", + "str": "ALTeR=SET", + "len": 9, + "last": 9, + "list": { + "@type": "PhpMyAdmin\\SqlParser\\TokensList", + "tokens": [ + { + "@type": "PhpMyAdmin\\SqlParser\\Token", + "token": "ALTeR", + "value": "ALTER", + "keyword": "ALTER", + "type": 1, + "flags": 3, + "position": 0 + }, + { + "@type": "PhpMyAdmin\\SqlParser\\Token", + "token": "=", + "value": "=", + "keyword": null, + "type": 2, + "flags": 2, + "position": 5 + }, + { + "@type": "PhpMyAdmin\\SqlParser\\Token", + "token": "SET", + "value": "SET", + "keyword": "SET", + "type": 1, + "flags": 11, + "position": 6 + }, + { + "@type": "PhpMyAdmin\\SqlParser\\Token", + "token": null, + "value": null, + "keyword": null, + "type": 9, + "flags": 0, + "position": null + } + ], + "count": 4, + "idx": 4 + }, + "delimiter": ";", + "delimiterLen": 1, + "strict": false, + "errors": [] + }, + "parser": { + "@type": "PhpMyAdmin\\SqlParser\\Parser", + "list": { + "@type": "@1" + }, + "statements": [ + { + "@type": "PhpMyAdmin\\SqlParser\\Statements\\AlterStatement", + "table": null, + "altered": [], + "options": null, + "first": 0, + "last": 0 + }, + { + "@type": "PhpMyAdmin\\SqlParser\\Statements\\SetStatement", + "options": { + "@type": "PhpMyAdmin\\SqlParser\\Components\\OptionsArray", + "options": [] + }, + "endOptions": null, + "set": [], + "first": 1, + "last": 2 + } + ], + "brackets": 0, + "strict": false, + "errors": [] + }, + "errors": { + "lexer": [], + "parser": [ + [ + "Unrecognized alter operation.", + { + "@type": "@2" + }, + 0 + ] + ] + } +} \ No newline at end of file diff --git a/tests/data/bugs/fuzz5.in b/tests/data/bugs/fuzz5.in new file mode 100644 index 000000000..61dd39880 --- /dev/null +++ b/tests/data/bugs/fuzz5.in @@ -0,0 +1 @@ ++0xO \ No newline at end of file diff --git a/tests/data/bugs/fuzz5.out b/tests/data/bugs/fuzz5.out new file mode 100644 index 000000000..ee8ec15e4 --- /dev/null +++ b/tests/data/bugs/fuzz5.out @@ -0,0 +1,76 @@ +{ + "query": "+0xO", + "lexer": { + "@type": "PhpMyAdmin\\SqlParser\\Lexer", + "str": "+0xO", + "len": 4, + "last": 4, + "list": { + "@type": "PhpMyAdmin\\SqlParser\\TokensList", + "tokens": [ + { + "@type": "PhpMyAdmin\\SqlParser\\Token", + "token": "+0x", + "value": 0, + "keyword": null, + "type": 6, + "flags": 1, + "position": 0 + }, + { + "@type": "PhpMyAdmin\\SqlParser\\Token", + "token": "O", + "value": "O", + "keyword": null, + "type": 0, + "flags": 0, + "position": 3 + }, + { + "@type": "PhpMyAdmin\\SqlParser\\Token", + "token": null, + "value": null, + "keyword": null, + "type": 9, + "flags": 0, + "position": null + } + ], + "count": 3, + "idx": 3 + }, + "delimiter": ";", + "delimiterLen": 1, + "strict": false, + "errors": [] + }, + "parser": { + "@type": "PhpMyAdmin\\SqlParser\\Parser", + "list": { + "@type": "@1" + }, + "statements": [], + "brackets": 0, + "strict": false, + "errors": [] + }, + "errors": { + "lexer": [], + "parser": [ + [ + "Unexpected beginning of statement.", + { + "@type": "@2" + }, + 0 + ], + [ + "Unexpected beginning of statement.", + { + "@type": "@3" + }, + 0 + ] + ] + } +} \ No newline at end of file diff --git a/tests/data/bugs/fuzz6.in b/tests/data/bugs/fuzz6.in new file mode 100644 index 000000000..f3afa7709 --- /dev/null +++ b/tests/data/bugs/fuzz6.in @@ -0,0 +1 @@ +-+0x! \ No newline at end of file diff --git a/tests/data/bugs/fuzz6.out b/tests/data/bugs/fuzz6.out new file mode 100644 index 000000000..fce6bf5b7 --- /dev/null +++ b/tests/data/bugs/fuzz6.out @@ -0,0 +1,69 @@ +{ + "query": "-+0x!", + "lexer": { + "@type": "PhpMyAdmin\\SqlParser\\Lexer", + "str": "-+0x!", + "len": 5, + "last": 5, + "list": { + "@type": "PhpMyAdmin\\SqlParser\\TokensList", + "tokens": [ + { + "@type": "PhpMyAdmin\\SqlParser\\Token", + "token": "-+0x", + "value": 0, + "keyword": null, + "type": 6, + "flags": 9, + "position": 0 + }, + { + "@type": "PhpMyAdmin\\SqlParser\\Token", + "token": "!", + "value": "!", + "keyword": null, + "type": 2, + "flags": 2, + "position": 4 + }, + { + "@type": "PhpMyAdmin\\SqlParser\\Token", + "token": null, + "value": null, + "keyword": null, + "type": 9, + "flags": 0, + "position": null + } + ], + "count": 3, + "idx": 3 + }, + "delimiter": ";", + "delimiterLen": 1, + "strict": false, + "errors": [] + }, + "parser": { + "@type": "PhpMyAdmin\\SqlParser\\Parser", + "list": { + "@type": "@1" + }, + "statements": [], + "brackets": 0, + "strict": false, + "errors": [] + }, + "errors": { + "lexer": [], + "parser": [ + [ + "Unexpected beginning of statement.", + { + "@type": "@2" + }, + 0 + ] + ] + } +} \ No newline at end of file diff --git a/tests/data/bugs/gh508.in b/tests/data/bugs/gh508.in new file mode 100644 index 000000000..bef3a359a --- /dev/null +++ b/tests/data/bugs/gh508.in @@ -0,0 +1 @@ +0X0F \ No newline at end of file diff --git a/tests/data/bugs/gh508.out b/tests/data/bugs/gh508.out new file mode 100644 index 000000000..085f75e6d --- /dev/null +++ b/tests/data/bugs/gh508.out @@ -0,0 +1,60 @@ +{ + "query": "0X0F", + "lexer": { + "@type": "PhpMyAdmin\\SqlParser\\Lexer", + "str": "0X0F", + "len": 4, + "last": 4, + "list": { + "@type": "PhpMyAdmin\\SqlParser\\TokensList", + "tokens": [ + { + "@type": "PhpMyAdmin\\SqlParser\\Token", + "token": "0X0F", + "value": "0X0F", + "keyword": null, + "type": 0, + "flags": 0, + "position": 0 + }, + { + "@type": "PhpMyAdmin\\SqlParser\\Token", + "token": null, + "value": null, + "keyword": null, + "type": 9, + "flags": 0, + "position": null + } + ], + "count": 2, + "idx": 2 + }, + "delimiter": ";", + "delimiterLen": 1, + "strict": false, + "errors": [] + }, + "parser": { + "@type": "PhpMyAdmin\\SqlParser\\Parser", + "list": { + "@type": "@1" + }, + "statements": [], + "brackets": 0, + "strict": false, + "errors": [] + }, + "errors": { + "lexer": [], + "parser": [ + [ + "Unexpected beginning of statement.", + { + "@type": "@2" + }, + 0 + ] + ] + } +} \ No newline at end of file diff --git a/tests/data/lexer/lexNumber.in b/tests/data/lexer/lexNumber.in index 6fe38851d..a0fff528e 100644 --- a/tests/data/lexer/lexNumber.in +++ b/tests/data/lexer/lexNumber.in @@ -1,3 +1,3 @@ -SELECT 12, 34, 5.67, 0x89, -10, --11, +12, .15, 0xFFa, 0xfFA, 0XFfA, -0xFFa, -0xfFA, -0XFfA, 1e-10, 1e10, .5e10, b'10'; --- invalid number -SELECT 12ex10, b'15'; \ No newline at end of file +SELECT 12, 34, 5.67, 0x89, -10, --11, +12, .15, 0xFFa, 0xfFA, +0xfFA, -0xFFa, -0xfFA, 1e-10, 1e10, .5e10, b'10'; +-- invalid numbers +SELECT 12ex10, b'15', 0XFfA, -0XFfA, +0XFfA; \ No newline at end of file diff --git a/tests/data/lexer/lexNumber.out b/tests/data/lexer/lexNumber.out index f28612d86..5c6988dd1 100644 --- a/tests/data/lexer/lexNumber.out +++ b/tests/data/lexer/lexNumber.out @@ -1,10 +1,10 @@ { - "query": "SELECT 12, 34, 5.67, 0x89, -10, --11, +12, .15, 0xFFa, 0xfFA, 0XFfA, -0xFFa, -0xfFA, -0XFfA, 1e-10, 1e10, .5e10, b'10';\n-- invalid number\nSELECT 12ex10, b'15';", + "query": "SELECT 12, 34, 5.67, 0x89, -10, --11, +12, .15, 0xFFa, 0xfFA, +0xfFA, -0xFFa, -0xfFA, 1e-10, 1e10, .5e10, b'10';\n-- invalid numbers\nSELECT 12ex10, b'15', 0XFfA, -0XFfA, +0XFfA;", "lexer": { "@type": "PhpMyAdmin\\SqlParser\\Lexer", - "str": "SELECT 12, 34, 5.67, 0x89, -10, --11, +12, .15, 0xFFa, 0xfFA, 0XFfA, -0xFFa, -0xfFA, -0XFfA, 1e-10, 1e10, .5e10, b'10';\n-- invalid number\nSELECT 12ex10, b'15';", - "len": 159, - "last": 159, + "str": "SELECT 12, 34, 5.67, 0x89, -10, --11, +12, .15, 0xFFa, 0xfFA, +0xfFA, -0xFFa, -0xfFA, 1e-10, 1e10, .5e10, b'10';\n-- invalid numbers\nSELECT 12ex10, b'15', 0XFfA, -0XFfA, +0XFfA;", + "len": 176, + "last": 176, "list": { "@type": "PhpMyAdmin\\SqlParser\\TokensList", "tokens": [ @@ -298,7 +298,7 @@ }, { "@type": "PhpMyAdmin\\SqlParser\\Token", - "token": "0XFfA", + "token": "+0xfFA", "value": 4090, "keyword": null, "type": 6, @@ -312,7 +312,7 @@ "keyword": null, "type": 2, "flags": 16, - "position": 67 + "position": 68 }, { "@type": "PhpMyAdmin\\SqlParser\\Token", @@ -321,7 +321,7 @@ "keyword": null, "type": 3, "flags": 0, - "position": 68 + "position": 69 }, { "@type": "PhpMyAdmin\\SqlParser\\Token", @@ -330,7 +330,7 @@ "keyword": null, "type": 6, "flags": 9, - "position": 69 + "position": 70 }, { "@type": "PhpMyAdmin\\SqlParser\\Token", @@ -339,7 +339,7 @@ "keyword": null, "type": 2, "flags": 16, - "position": 75 + "position": 76 }, { "@type": "PhpMyAdmin\\SqlParser\\Token", @@ -348,7 +348,7 @@ "keyword": null, "type": 3, "flags": 0, - "position": 76 + "position": 77 }, { "@type": "PhpMyAdmin\\SqlParser\\Token", @@ -357,7 +357,7 @@ "keyword": null, "type": 6, "flags": 9, - "position": 77 + "position": 78 }, { "@type": "PhpMyAdmin\\SqlParser\\Token", @@ -366,35 +366,8 @@ "keyword": null, "type": 2, "flags": 16, - "position": 83 - }, - { - "@type": "PhpMyAdmin\\SqlParser\\Token", - "token": " ", - "value": " ", - "keyword": null, - "type": 3, - "flags": 0, "position": 84 }, - { - "@type": "PhpMyAdmin\\SqlParser\\Token", - "token": "-0XFfA", - "value": -4090, - "keyword": null, - "type": 6, - "flags": 9, - "position": 85 - }, - { - "@type": "PhpMyAdmin\\SqlParser\\Token", - "token": ",", - "value": ",", - "keyword": null, - "type": 2, - "flags": 16, - "position": 91 - }, { "@type": "PhpMyAdmin\\SqlParser\\Token", "token": " ", @@ -402,7 +375,7 @@ "keyword": null, "type": 3, "flags": 0, - "position": 92 + "position": 85 }, { "@type": "PhpMyAdmin\\SqlParser\\Token", @@ -411,7 +384,7 @@ "keyword": null, "type": 6, "flags": 4, - "position": 93 + "position": 86 }, { "@type": "PhpMyAdmin\\SqlParser\\Token", @@ -420,7 +393,7 @@ "keyword": null, "type": 2, "flags": 16, - "position": 98 + "position": 91 }, { "@type": "PhpMyAdmin\\SqlParser\\Token", @@ -429,7 +402,7 @@ "keyword": null, "type": 3, "flags": 0, - "position": 99 + "position": 92 }, { "@type": "PhpMyAdmin\\SqlParser\\Token", @@ -438,7 +411,7 @@ "keyword": null, "type": 6, "flags": 4, - "position": 100 + "position": 93 }, { "@type": "PhpMyAdmin\\SqlParser\\Token", @@ -447,7 +420,7 @@ "keyword": null, "type": 2, "flags": 16, - "position": 104 + "position": 97 }, { "@type": "PhpMyAdmin\\SqlParser\\Token", @@ -456,7 +429,7 @@ "keyword": null, "type": 3, "flags": 0, - "position": 105 + "position": 98 }, { "@type": "PhpMyAdmin\\SqlParser\\Token", @@ -465,7 +438,7 @@ "keyword": null, "type": 6, "flags": 6, - "position": 106 + "position": 99 }, { "@type": "PhpMyAdmin\\SqlParser\\Token", @@ -474,7 +447,7 @@ "keyword": null, "type": 2, "flags": 16, - "position": 111 + "position": 104 }, { "@type": "PhpMyAdmin\\SqlParser\\Token", @@ -483,7 +456,7 @@ "keyword": null, "type": 3, "flags": 0, - "position": 112 + "position": 105 }, { "@type": "PhpMyAdmin\\SqlParser\\Token", @@ -492,7 +465,7 @@ "keyword": null, "type": 6, "flags": 16, - "position": 113 + "position": 106 }, { "@type": "PhpMyAdmin\\SqlParser\\Token", @@ -501,7 +474,7 @@ "keyword": null, "type": 9, "flags": 0, - "position": 118 + "position": 111 }, { "@type": "PhpMyAdmin\\SqlParser\\Token", @@ -510,16 +483,16 @@ "keyword": null, "type": 3, "flags": 0, - "position": 119 + "position": 112 }, { "@type": "PhpMyAdmin\\SqlParser\\Token", - "token": "-- invalid number", - "value": "-- invalid number", + "token": "-- invalid numbers", + "value": "-- invalid numbers", "keyword": null, "type": 4, "flags": 4, - "position": 120 + "position": 113 }, { "@type": "PhpMyAdmin\\SqlParser\\Token", @@ -528,7 +501,7 @@ "keyword": null, "type": 3, "flags": 0, - "position": 137 + "position": 131 }, { "@type": "PhpMyAdmin\\SqlParser\\Token", @@ -537,7 +510,7 @@ "keyword": "SELECT", "type": 1, "flags": 3, - "position": 138 + "position": 132 }, { "@type": "PhpMyAdmin\\SqlParser\\Token", @@ -546,7 +519,7 @@ "keyword": null, "type": 3, "flags": 0, - "position": 144 + "position": 138 }, { "@type": "PhpMyAdmin\\SqlParser\\Token", @@ -555,7 +528,7 @@ "keyword": null, "type": 0, "flags": 0, - "position": 145 + "position": 139 }, { "@type": "PhpMyAdmin\\SqlParser\\Token", @@ -564,7 +537,7 @@ "keyword": null, "type": 2, "flags": 16, - "position": 151 + "position": 145 }, { "@type": "PhpMyAdmin\\SqlParser\\Token", @@ -573,7 +546,7 @@ "keyword": null, "type": 3, "flags": 0, - "position": 152 + "position": 146 }, { "@type": "PhpMyAdmin\\SqlParser\\Token", @@ -582,7 +555,7 @@ "keyword": null, "type": 0, "flags": 0, - "position": 153 + "position": 147 }, { "@type": "PhpMyAdmin\\SqlParser\\Token", @@ -591,8 +564,107 @@ "keyword": null, "type": 7, "flags": 1, + "position": 148 + }, + { + "@type": "PhpMyAdmin\\SqlParser\\Token", + "token": ",", + "value": ",", + "keyword": null, + "type": 2, + "flags": 16, + "position": 152 + }, + { + "@type": "PhpMyAdmin\\SqlParser\\Token", + "token": " ", + "value": " ", + "keyword": null, + "type": 3, + "flags": 0, + "position": 153 + }, + { + "@type": "PhpMyAdmin\\SqlParser\\Token", + "token": "0XFfA", + "value": "0XFfA", + "keyword": null, + "type": 0, + "flags": 0, "position": 154 }, + { + "@type": "PhpMyAdmin\\SqlParser\\Token", + "token": ",", + "value": ",", + "keyword": null, + "type": 2, + "flags": 16, + "position": 159 + }, + { + "@type": "PhpMyAdmin\\SqlParser\\Token", + "token": " ", + "value": " ", + "keyword": null, + "type": 3, + "flags": 0, + "position": 160 + }, + { + "@type": "PhpMyAdmin\\SqlParser\\Token", + "token": "-", + "value": "-", + "keyword": null, + "type": 2, + "flags": 1, + "position": 161 + }, + { + "@type": "PhpMyAdmin\\SqlParser\\Token", + "token": "0XFfA", + "value": "0XFfA", + "keyword": null, + "type": 0, + "flags": 0, + "position": 162 + }, + { + "@type": "PhpMyAdmin\\SqlParser\\Token", + "token": ",", + "value": ",", + "keyword": null, + "type": 2, + "flags": 16, + "position": 167 + }, + { + "@type": "PhpMyAdmin\\SqlParser\\Token", + "token": " ", + "value": " ", + "keyword": null, + "type": 3, + "flags": 0, + "position": 168 + }, + { + "@type": "PhpMyAdmin\\SqlParser\\Token", + "token": "+", + "value": "+", + "keyword": null, + "type": 2, + "flags": 1, + "position": 169 + }, + { + "@type": "PhpMyAdmin\\SqlParser\\Token", + "token": "0XFfA", + "value": "0XFfA", + "keyword": null, + "type": 0, + "flags": 0, + "position": 170 + }, { "@type": "PhpMyAdmin\\SqlParser\\Token", "token": ";", @@ -600,7 +672,7 @@ "keyword": null, "type": 9, "flags": 0, - "position": 158 + "position": 175 }, { "@type": "PhpMyAdmin\\SqlParser\\Token", @@ -612,7 +684,7 @@ "position": null } ], - "count": 67, + "count": 75, "idx": 0 }, "delimiter": ";", diff --git a/tests/data/parser/parseArrayErr3.out b/tests/data/parser/parseArrayErr3.out index 30259a7c8..ce70cc44d 100644 --- a/tests/data/parser/parseArrayErr3.out +++ b/tests/data/parser/parseArrayErr3.out @@ -239,6 +239,14 @@ }, "errors": { "lexer": [], - "parser": [] + "parser": [ + [ + "A closing bracket was expected.", + { + "@type": "@17" + }, + 0 + ] + ] } } \ No newline at end of file diff --git a/tools/contexts/_common.txt b/tools/contexts/_common.txt index 5be2a01e6..5d48e8f7d 100644 --- a/tools/contexts/_common.txt +++ b/tools/contexts/_common.txt @@ -7,6 +7,7 @@ BIGINT (D) BINARY (D) BINARY VARYING (D) BLOB (D) +BOOL (D) BOOLEAN (D) CHAR (D) CHARACTER (D)