PHP-SQL-Parser icon indicating copy to clipboard operation
PHP-SQL-Parser copied to clipboard

Allow selection of user-defined variables wihtout space between variable and assignment operator

Open Seros opened this issue 9 years ago • 0 comments

Given following statement (from the MySQL documentation):

$parser = new PHPSQLParser();
$parsed = $parser->parse('SELECT (@a:=20), @a FROM tbl_name', true);

Expectation is a result with the parsed meta data. Actual result is following exception:

cannot calculate position of := within  FROM tbl_name

The problem is that a colon is now allowed right after a user-defined varaible without a space in between (see \PHPSQLParser\positions\PositionCalculator::$allowedOnOperator and /src/PHPSQLParser/positions/PositionCalculator.php:164)

Seros avatar Dec 09 '16 09:12 Seros