fix issue #299: arithmetic operations in brackets are comma separated #306
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
for example the query:
would become:
This is a regression caused by commit 3a9d906, that meant to add missing
commas in expressions like
CAST(... AS DECIMAL(16, 2))
,but added too many commas visibly.
=> revert the parts of that commit that changed the code (leave the
added test assertion)
=> change the
ExpressionListProcessor
code that handlesunspecified nodes.
That code was added in commit 63d59d7, apparently to solve issue 51:
https://code.google.com/archive/p/php-sql-parser/issues/51
It seems to have copied and pasted the code that handles function
arguments, just above.
But that code does not keep commas,
and while the
FunctionBuilder
adds them back,the
SelectBracketExpressionBuilder
does not.The
issue51Test.php
test seems to cover the bug described in issue 51,and it still passes (as do the other tests).
So maybe we do not need the same handling as for function arguments in
unspecified nodes?
Hopefully someone with a better understanding of this code can have a look.