Skip to content

Commit

Permalink
Support more GRANT query types
Browse files Browse the repository at this point in the history
  • Loading branch information
adamziel committed Aug 12, 2024
1 parent de70be1 commit 1fe180c
Show file tree
Hide file tree
Showing 4 changed files with 122 additions and 62 deletions.
103 changes: 76 additions & 27 deletions tests/WP_MySQL_Parser_Tests.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ class WP_MySQL_Parser_Tests extends TestCase {
/**
* @dataProvider mysqlQueries
*/
public function testParsesWithoutErrors( $query ) {
$lexer = new MySQLLexer($query, 80019);
public function testParsesWithoutErrors( $query, $mysql_version=80000 ) {
$lexer = new MySQLLexer($query, $mysql_version);

Check warning on line 14 in tests/WP_MySQL_Parser_Tests.php

View workflow job for this annotation

GitHub Actions / Check code style

Equals sign not aligned with surrounding assignments; expected 2 spaces but found 1 space

Check warning on line 14 in tests/WP_MySQL_Parser_Tests.php

View workflow job for this annotation

GitHub Actions / Check code style

Equals sign not aligned with surrounding assignments; expected 2 spaces but found 1 space
$parser = new MySQLParser($lexer);
$parser->query();

Expand All @@ -22,28 +22,8 @@ public function testParsesWithoutErrors( $query ) {

public static function mysqlQueries() {
return array(
'simple' => ['SELECT 1'],
'simple' => ['SELECT 1'],
'complexSelect' => [<<<SQL
WITH mytable AS (select 1 as a, `b`.c from dual)
SELECT HIGH_PRIORITY DISTINCT
CONCAT("a", "b"),
UPPER(z),
DATE_FORMAT(col_a, '%Y-%m-%d %H:%i:%s') as formatted_date,
DATE_ADD(col_b, INTERVAL 1 DAY) as date_plus_one,
col_a
FROM
my_table as subquery
FORCE INDEX (idx_col_a)
LEFT JOIN (SELECT a_column_yo from mytable) as t2
ON (t2.id = mytable.id AND t2.id = 1)
WHERE NOT EXISTS (SELECT 1)
GROUP BY col_a, col_b
HAVING 1 = 2
UNION SELECT * from table_cde
ORDER BY col_a DESC, col_b ASC
FOR UPDATE
SQL],
// CREATE
'createDatabase' => ['CREATE DATABASE mydatabase;'],

Check warning on line 26 in tests/WP_MySQL_Parser_Tests.php

View workflow job for this annotation

GitHub Actions / Check code style

Array double arrow not aligned correctly; expected 16 space(s) between "'createDatabase'" and double arrow, but found 1.

Check warning on line 26 in tests/WP_MySQL_Parser_Tests.php

View workflow job for this annotation

GitHub Actions / Check code style

Array double arrow not aligned correctly; expected 16 space(s) between "'createDatabase'" and double arrow, but found 1.
'createTable' => [<<<SQL

Check warning on line 27 in tests/WP_MySQL_Parser_Tests.php

View workflow job for this annotation

GitHub Actions / Check code style

Array double arrow not aligned correctly; expected 19 space(s) between "'createTable'" and double arrow, but found 1.

Check warning on line 27 in tests/WP_MySQL_Parser_Tests.php

View workflow job for this annotation

GitHub Actions / Check code style

Array double arrow not aligned correctly; expected 19 space(s) between "'createTable'" and double arrow, but found 1.
CREATE TABLE products (
product_id INT AUTO_INCREMENT PRIMARY KEY,
Expand All @@ -68,6 +48,8 @@ public static function mysqlQueries() {
FULLTEXT INDEX idx_col_l (`col_l`)
) DEFAULT CHARACTER SET cp1250 COLLATE cp1250_general_ci;
SQL],
// INSERT
'insertMulti' => [<<<SQL

Check warning on line 53 in tests/WP_MySQL_Parser_Tests.php

View workflow job for this annotation

GitHub Actions / Check code style

Array double arrow not aligned correctly; expected 19 space(s) between "'insertMulti'" and double arrow, but found 1.

Check warning on line 53 in tests/WP_MySQL_Parser_Tests.php

View workflow job for this annotation

GitHub Actions / Check code style

Array double arrow not aligned correctly; expected 19 space(s) between "'insertMulti'" and double arrow, but found 1.
INSERT INTO customers (first_name, last_name, email, phone_number, address, birth_date)
VALUES
Expand Down Expand Up @@ -95,6 +77,8 @@ public static function mysqlQueries() {
phone_number = VALUES(phone_number),
address = VALUES(address);
SQL],
// UPDATE
'updateJoin' => [<<<SQL
UPDATE orders o
JOIN (
Expand Down Expand Up @@ -133,6 +117,8 @@ public static function mysqlQueries() {
WHERE `status` = 'Pending'
LIMIT 10;
SQL],
// DELETE
'deleteJoin' => [<<<SQL
DELETE o
FROM orders o
Expand All @@ -150,23 +136,82 @@ public static function mysqlQueries() {
WHERE `status` = 'Cancelled'
LIMIT 5;
SQL],
// ALTER
'alterConstraint' => [<<<SQL
ALTER TABLE orders
ADD CONSTRAINT fk_product_id
FOREIGN KEY (product_id) REFERENCES products(product_id)
ON DELETE CASCADE;
SQL],
SQL,
80017
],
'alterColumn' => ['ALTER TABLE products
MODIFY COLUMN product_name VARCHAR(200) NOT NULL;'],
'alterIndex' => ['ALTER TABLE products
DROP INDEX idx_col_h_i,
ADD INDEX idx_col_h_i_j (`col_h`, `col_i`, `col_j`);'],

// SELECT
'simple' => ['SELECT 1'],
'complexSelect' => [<<<SQL
WITH mytable AS (select 1 as a, `b`.c from dual)
SELECT HIGH_PRIORITY DISTINCT
CONCAT("a", "b"),
UPPER(z),
DATE_FORMAT(col_a, '%Y-%m-%d %H:%i:%s') as formatted_date,
DATE_ADD(col_b, INTERVAL 1 DAY) as date_plus_one,
col_a
FROM
my_table as subquery
FORCE INDEX (idx_col_a)
LEFT JOIN (SELECT a_column_yo from mytable) as t2
ON (t2.id = mytable.id AND t2.id = 1)
WHERE NOT EXISTS (SELECT 1)
GROUP BY col_a, col_b
HAVING 1 = 2
UNION SELECT * from table_cde
ORDER BY col_a DESC, col_b ASC
FOR UPDATE
SQL],

// DROP
'dropTable' => ['DROP TABLE products;'],
'dropIndex' => ['DROP INDEX idx_col_h_i_j ON products;'],
'dropColumn' => ['ALTER TABLE products DROP COLUMN product_name;'],
'dropConstraint' => ['ALTER TABLE products DROP FOREIGN KEY fk_product_id;'],
'dropDatabase' => ['DROP DATABASE mydatabase;'],
'createDatabase' => ['CREATE DATABASE mydatabase;'],

// GRANT
'grantAll' => ['GRANT ALL ON mydatabase TO myuser@localhost;'],
'grantSelect' => ['GRANT SELECT ON mydatabase TO myuser@localhost;'],
'grantInsert' => ['GRANT INSERT ON mydatabase TO myuser@localhost;'],
'grantUpdate' => ['GRANT UPDATE ON mydatabase TO myuser@localhost;'],
'grantDelete' => ['GRANT DELETE ON mydatabase TO myuser@localhost;'],
'grantCreate' => ['GRANT CREATE ON mydatabase TO myuser@localhost;'],
'grantDrop' => ['GRANT DROP ON mydatabase TO myuser@localhost;'],
'grantAlter' => ['GRANT ALTER ON mydatabase TO myuser@localhost;'],
'grantIndex' => ['GRANT INDEX ON mydatabase TO myuser@localhost;'],
'grantCreateView' => ['GRANT CREATE VIEW ON mydatabase TO myuser@localhost;'],
'grantShowView' => ['GRANT SHOW VIEW ON mydatabase TO myuser@localhost;'],
'grantCreateRoutine' => ['GRANT CREATE ROUTINE ON mydatabase TO myuser@localhost;'],
'grantAlterRoutine' => ['GRANT ALTER ROUTINE ON mydatabase TO myuser@localhost;'],
'grantExecute' => ['GRANT EXECUTE ON mydatabase TO myuser@localhost;'],
'grantEvent' => ['GRANT EVENT ON mydatabase TO myuser@localhost;'],
'grantTrigger' => ['GRANT TRIGGER ON mydatabase TO myuser@localhost;'],
'grantLockTables' => ['GRANT LOCK TABLES ON mydatabase TO myuser@localhost;'],
'grantReferences' => ['GRANT REFERENCES ON mydatabase TO myuser@localhost;'],
'grantCreateTemporaryTables' => ['GRANT CREATE TEMPORARY TABLES ON mydatabase TO myuser@localhost;'],
'grantShowDatabases' => ['GRANT SHOW DATABASES ON mydatabase TO myuser@localhost;'],
'grantSuper' => ['GRANT SUPER ON mydatabase TO myuser@localhost;'],
'grantReload' => ['GRANT RELOAD ON mydatabase TO myuser@localhost;'],
'grantShutdown' => ['GRANT SHUTDOWN ON mydatabase TO myuser@localhost;', 80017],
'grantProcess' => ['GRANT PROCESS ON mydatabase TO myuser@localhost;'],
'grantFile' => ['GRANT FILE ON mydatabase TO myuser@localhost;'],
'grantSelectOnAllTables' => ['GRANT SELECT ON mydatabase.* TO myuser@localhost;', 80000],
'grantSelectOnTable' => ['GRANT SELECT ON mydatabase.mytable TO myuser@localhost;', 80017],

// SHOW
'showDatabases' => ['SHOW DATABASES;'],
'showTables' => ['SHOW TABLES;'],
'showColumns' => ['SHOW COLUMNS FROM products;'],
Expand All @@ -193,12 +238,14 @@ public static function mysqlQueries() {
'showCreateView' => ['SHOW CREATE VIEW myview;'],
'showCreateUser' => ['SHOW CREATE USER myuser;'],
'showCreateRole' => ['SHOW CREATE ROLE myrole;'],
'showCreateTablespace' => ['SHOW CREATE TABLESPACE mytablespace;'],
'showCreateTablespace' => ['SHOW CREATE TABLESPACE mytablespace;', 80017],
'showCreateDatabase' => ['SHOW CREATE DATABASE mydatabase;'],
'showCreateDatabaseIfNotExists' => ['SHOW CREATE DATABASE IF NOT EXISTS myevent;'],
'showExtended' => ['SHOW EXTENDED COLUMNS FROM products;'],
'showFull' => ['SHOW FULL COLUMNS FROM products;'],
'showExtendedFull' => ['SHOW EXTENDED FULL COLUMNS FROM products;'],

// SET
'setVariable' => ['SET @myvar = 1;'],
'setGlobalVariable' => ['SET GLOBAL myvar = 1;'],
'setSessionVariable' => ['SET SESSION myvar = 1;'],
Expand All @@ -212,6 +259,8 @@ public static function mysqlQueries() {
'setSqlMode' => ['SET SQL_MODE = "ANSI_QUOTES";'],
'setTimeZone' => ['SET TIME_ZONE = "+00:00";'],
'setPassword' => ["SET PASSWORD = 'newpassword';"],

// Transactions
'begin' => ['BEGIN;'],
'commit' => ['COMMIT;'],
'rollback' => ['ROLLBACK;'],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4017,6 +4017,9 @@ protected function IDENTIFIER_OR_KEYWORD()
$this->IDENTIFIER();
}
break;
case 'ROUTINE':
$this->ROUTINE_SYMBOL();
break;
case 'ROW':
if ($this->serverVersion < 80000) {
$this->ROW_SYMBOL();
Expand Down Expand Up @@ -8942,6 +8945,11 @@ protected function IDENTIFIER()
{
$this->setType(self::IDENTIFIER);
}

protected function ROUTINE_SYMBOL()
{
$this->setType(self::ROUTINE_SYMBOL);
}

protected function MYSQL_COMMENT_START()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7492,7 +7492,7 @@ public function grant()
$children[] = $this->match(MySQLLexer::ADMIN_SYMBOL);
$children[] = $this->match(MySQLLexer::OPTION_SYMBOL);
}
} elseif (($token->getType() === MySQLLexer::SELECT_SYMBOL ||
} elseif ($token->getType() === MySQLLexer::SELECT_SYMBOL ||
$token->getType() === MySQLLexer::INSERT_SYMBOL ||
$token->getType() === MySQLLexer::UPDATE_SYMBOL ||
$token->getType() === MySQLLexer::REFERENCES_SYMBOL ||
Expand Down Expand Up @@ -7520,11 +7520,12 @@ public function grant()
$token->getType() === MySQLLexer::LOCK_SYMBOL ||
$token->getType() === MySQLLexer::REPLICATION_SYMBOL ||
$token->getType() === MySQLLexer::SHOW_SYMBOL ||
$token->getType() === MySQLLexer::ALTER_SYMBOL ||
($this->serverVersion > 80000 &&
($token->getType() === MySQLLexer::CREATE_SYMBOL || $token->getType() === MySQLLexer::DROP_SYMBOL)) ||
$token->getType() === MySQLLexer::GRANT_SYMBOL ||
$token->getType() === MySQLLexer::ALL_SYMBOL) &&
$this->lexer->peekNextToken(2)->getType() === MySQLLexer::ON_SYMBOL) {
$token->getType() === MySQLLexer::ALL_SYMBOL
) {
if ($token->getType() === MySQLLexer::ALL_SYMBOL) {
$children[] = $this->match(MySQLLexer::ALL_SYMBOL);
if ($this->lexer->peekNextToken()->getType() === MySQLLexer::PRIVILEGES_SYMBOL) {
Expand All @@ -7534,6 +7535,9 @@ public function grant()
} else {
$children[] = $this->roleOrPrivilegesList();
}
if ($this->lexer->peekNextToken()->getType() === MySQLLexer::ROUTINE_SYMBOL) {
$children[] = $this->match(MySQLLexer::ROUTINE_SYMBOL);
}
$children[] = $this->match(MySQLLexer::ON_SYMBOL);
if ($this->lexer->peekNextToken()->getType() === MySQLLexer::TABLE_SYMBOL ||
$this->lexer->peekNextToken()->getType() === MySQLLexer::FUNCTION_SYMBOL ||
Expand Down Expand Up @@ -7837,32 +7841,10 @@ public function roleOrPrivilege()
$token1 = $this->lexer->peekNextToken();
$token2 = $this->lexer->peekNextToken(2);
$children = [];

if ($this->serverVersion > 80000 &&
($token1->getType() === MySQLLexer::IDENTIFIER ||
$token1->getType() === MySQLLexer::BACK_TICK_QUOTED_ID ||
$token1->getType() === MySQLLexer::DOUBLE_QUOTED_TEXT ||
$this->isIdentifierKeyword($token1) ||
$token1->getType() === MySQLLexer::SINGLE_QUOTED_TEXT)) {
$children[] = $this->roleIdentifierOrText();
if ($this->lexer->peekNextToken()->getType() === MySQLLexer::OPEN_PAR_SYMBOL) {
$children[] = $this->columnInternalRefList();
} elseif ($this->lexer->peekNextToken()->getType() === MySQLLexer::AT_TEXT_SUFFIX ||
$this->lexer->peekNextToken()->getType() === MySQLLexer::AT_SIGN_SYMBOL) {
if ($this->lexer->peekNextToken()->getType() === MySQLLexer::AT_TEXT_SUFFIX) {
$children[] = $this->match(MySQLLexer::AT_TEXT_SUFFIX);
} else {
$children[] = $this->match(MySQLLexer::AT_SIGN_SYMBOL);
$children[] = $this->textOrIdentifier();
}
}

return new ASTNode('roleOrPrivilege', $children);
} elseif (($token1->getType() === MySQLLexer::SELECT_SYMBOL ||
if (($token1->getType() === MySQLLexer::SELECT_SYMBOL ||
$token1->getType() === MySQLLexer::INSERT_SYMBOL ||
$token1->getType() === MySQLLexer::UPDATE_SYMBOL ||
$token1->getType() === MySQLLexer::REFERENCES_SYMBOL) &&
$token2->getType() !== MySQLLexer::ON_SYMBOL) {
$token1->getType() === MySQLLexer::REFERENCES_SYMBOL)) {
if ($token1->getType() === MySQLLexer::SELECT_SYMBOL) {
$children[] = $this->match(MySQLLexer::SELECT_SYMBOL);
} elseif ($token1->getType() === MySQLLexer::INSERT_SYMBOL) {
Expand Down Expand Up @@ -7899,10 +7881,14 @@ public function roleOrPrivilege()
$children[] = $this->match(MySQLLexer::GRANT_SYMBOL);
$children[] = $this->match(MySQLLexer::OPTION_SYMBOL);
return new ASTNode('roleOrPrivilege', $children);
} elseif ($token1->getType() === MySQLLexer::SHOW_SYMBOL) {
} elseif ($token1->getType() === MySQLLexer::SHOW_SYMBOL && $token2->getType() === MySQLLexer::DATABASES_SYMBOL) {
$children[] = $this->match(MySQLLexer::SHOW_SYMBOL);
$children[] = $this->match(MySQLLexer::DATABASES_SYMBOL);
return new ASTNode('roleOrPrivilege', $children);
} elseif ($token1->getType() === MySQLLexer::SHOW_SYMBOL && $token2->getType() === MySQLLexer::VIEW_SYMBOL) {
$children[] = $this->match(MySQLLexer::SHOW_SYMBOL);
$children[] = $this->match(MySQLLexer::VIEW_SYMBOL);
return new ASTNode('roleOrPrivilege', $children);
} elseif ($token1->getType() === MySQLLexer::CREATE_SYMBOL) {
$children[] = $this->match(MySQLLexer::CREATE_SYMBOL);
if ($this->lexer->peekNextToken()->getType() === MySQLLexer::TEMPORARY_SYMBOL) {
Expand Down Expand Up @@ -7940,10 +7926,6 @@ public function roleOrPrivilege()
throw new \Exception('Unexpected token in roleOrPrivilege: ' . $this->lexer->peekNextToken()->getText());
}
return new ASTNode('roleOrPrivilege', $children);
} elseif ($token1->getType() === MySQLLexer::SHOW_SYMBOL) {
$children[] = $this->match(MySQLLexer::SHOW_SYMBOL);
$children[] = $this->match(MySQLLexer::VIEW_SYMBOL);
return new ASTNode('roleOrPrivilege', $children);
} elseif ($token1->getType() === MySQLLexer::ALTER_SYMBOL) {
$children[] = $this->match(MySQLLexer::ALTER_SYMBOL);
if ($this->lexer->peekNextToken()->getType() === MySQLLexer::ROUTINE_SYMBOL) {
Expand All @@ -7959,6 +7941,26 @@ public function roleOrPrivilege()
$children[] = $this->match(MySQLLexer::DROP_SYMBOL);
}
$children[] = $this->match(MySQLLexer::ROLE_SYMBOL);
return new ASTNode('roleOrPrivilege', $children);
} elseif ($this->serverVersion > 80000 &&
($token1->getType() === MySQLLexer::IDENTIFIER ||
$token1->getType() === MySQLLexer::BACK_TICK_QUOTED_ID ||
$token1->getType() === MySQLLexer::DOUBLE_QUOTED_TEXT ||
$this->isIdentifierKeyword($token1) ||
$token1->getType() === MySQLLexer::SINGLE_QUOTED_TEXT)) {
$children[] = $this->roleIdentifierOrText();
if ($this->lexer->peekNextToken()->getType() === MySQLLexer::OPEN_PAR_SYMBOL) {
$children[] = $this->columnInternalRefList();
} elseif ($this->lexer->peekNextToken()->getType() === MySQLLexer::AT_TEXT_SUFFIX ||
$this->lexer->peekNextToken()->getType() === MySQLLexer::AT_SIGN_SYMBOL) {
if ($this->lexer->peekNextToken()->getType() === MySQLLexer::AT_TEXT_SUFFIX) {
$children[] = $this->match(MySQLLexer::AT_TEXT_SUFFIX);
} else {
$children[] = $this->match(MySQLLexer::AT_SIGN_SYMBOL);
$children[] = $this->textOrIdentifier();
}
}

return new ASTNode('roleOrPrivilege', $children);
} else {
throw new \Exception('Unexpected token in roleOrPrivilege: ' . $token1->getText());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,12 @@
require __DIR__ . '/MySQLParser.php';

$queries = [

Check failure on line 14 in wp-content/plugins/sqlite-database-integration/wp-includes/mysql-parser/sql-playground.php

View workflow job for this annotation

GitHub Actions / Check code style

Short array syntax is not allowed

Check failure on line 14 in wp-content/plugins/sqlite-database-integration/wp-includes/mysql-parser/sql-playground.php

View workflow job for this annotation

GitHub Actions / Check code style

Short array syntax is not allowed
'simple' => 'SELECT 1',
'simple' => ['SELECT 1'],

Check failure on line 15 in wp-content/plugins/sqlite-database-integration/wp-includes/mysql-parser/sql-playground.php

View workflow job for this annotation

GitHub Actions / Check code style

Tabs must be used to indent lines; spaces are not allowed

Check warning on line 15 in wp-content/plugins/sqlite-database-integration/wp-includes/mysql-parser/sql-playground.php

View workflow job for this annotation

GitHub Actions / Check code style

Array double arrow not aligned correctly; expected 11 space(s) between "'simple'" and double arrow, but found 1.

Check failure on line 15 in wp-content/plugins/sqlite-database-integration/wp-includes/mysql-parser/sql-playground.php

View workflow job for this annotation

GitHub Actions / Check code style

Expected 1 space after the array opener in a single line array. Found: no spaces

Check failure on line 15 in wp-content/plugins/sqlite-database-integration/wp-includes/mysql-parser/sql-playground.php

View workflow job for this annotation

GitHub Actions / Check code style

Short array syntax is not allowed

Check failure on line 15 in wp-content/plugins/sqlite-database-integration/wp-includes/mysql-parser/sql-playground.php

View workflow job for this annotation

GitHub Actions / Check code style

Expected 1 space before the array closer in a single line array. Found: no spaces

Check failure on line 15 in wp-content/plugins/sqlite-database-integration/wp-includes/mysql-parser/sql-playground.php

View workflow job for this annotation

GitHub Actions / Check code style

Tabs must be used to indent lines; spaces are not allowed

Check warning on line 15 in wp-content/plugins/sqlite-database-integration/wp-includes/mysql-parser/sql-playground.php

View workflow job for this annotation

GitHub Actions / Check code style

Array double arrow not aligned correctly; expected 11 space(s) between "'simple'" and double arrow, but found 1.

Check failure on line 15 in wp-content/plugins/sqlite-database-integration/wp-includes/mysql-parser/sql-playground.php

View workflow job for this annotation

GitHub Actions / Check code style

Expected 1 space after the array opener in a single line array. Found: no spaces

Check failure on line 15 in wp-content/plugins/sqlite-database-integration/wp-includes/mysql-parser/sql-playground.php

View workflow job for this annotation

GitHub Actions / Check code style

Short array syntax is not allowed

Check failure on line 15 in wp-content/plugins/sqlite-database-integration/wp-includes/mysql-parser/sql-playground.php

View workflow job for this annotation

GitHub Actions / Check code style

Expected 1 space before the array closer in a single line array. Found: no spaces
'grantSelectOnAll' => ['GRANT SELECT ON mydatabase.* TO myuser@localhost;'],

Check failure on line 16 in wp-content/plugins/sqlite-database-integration/wp-includes/mysql-parser/sql-playground.php

View workflow job for this annotation

GitHub Actions / Check code style

Tabs must be used to indent lines; spaces are not allowed

Check failure on line 16 in wp-content/plugins/sqlite-database-integration/wp-includes/mysql-parser/sql-playground.php

View workflow job for this annotation

GitHub Actions / Check code style

Expected 1 space after the array opener in a single line array. Found: no spaces

Check failure on line 16 in wp-content/plugins/sqlite-database-integration/wp-includes/mysql-parser/sql-playground.php

View workflow job for this annotation

GitHub Actions / Check code style

Short array syntax is not allowed

Check failure on line 16 in wp-content/plugins/sqlite-database-integration/wp-includes/mysql-parser/sql-playground.php

View workflow job for this annotation

GitHub Actions / Check code style

Tabs must be used to indent lines; spaces are not allowed

Check failure on line 16 in wp-content/plugins/sqlite-database-integration/wp-includes/mysql-parser/sql-playground.php

View workflow job for this annotation

GitHub Actions / Check code style

Expected 1 space after the array opener in a single line array. Found: no spaces

Check failure on line 16 in wp-content/plugins/sqlite-database-integration/wp-includes/mysql-parser/sql-playground.php

View workflow job for this annotation

GitHub Actions / Check code style

Short array syntax is not allowed
];

foreach ($queries as $key => $query) {
printAST(parse($query));
printAST(parse($query[0]));
}
// benchmarkParser($queries['acidTest']);

Expand All @@ -36,7 +37,7 @@ function benchmarkParser($query) {
}

function parse($query) {
$lexer = new MySQLLexer($query, 80019);
$lexer = new MySQLLexer($query, 80000);

Check warning on line 40 in wp-content/plugins/sqlite-database-integration/wp-includes/mysql-parser/sql-playground.php

View workflow job for this annotation

GitHub Actions / Check code style

Equals sign not aligned with surrounding assignments; expected 2 spaces but found 1 space

Check warning on line 40 in wp-content/plugins/sqlite-database-integration/wp-includes/mysql-parser/sql-playground.php

View workflow job for this annotation

GitHub Actions / Check code style

Equals sign not aligned with surrounding assignments; expected 2 spaces but found 1 space
$parser = new MySQLParser($lexer);
return $parser->query();
}
Expand Down

0 comments on commit 1fe180c

Please sign in to comment.