-
-
Notifications
You must be signed in to change notification settings - Fork 102
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Completing, refactoring and improving the WITH
statements parser
#363
Merged
MauricioFauth
merged 12 commits into
phpmyadmin:master
from
iifawzi:support-with-statements
Dec 29, 2021
Merged
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
f56b027
Refactoring and improving the support of the WITH statement and makin…
iifawzi 835a537
Adding more test cases for withStatements
iifawzi 75436a9
Fixing phpstan issues, and adding more test cases
iifawzi 2961130
Adding more tests for withStatements
iifawzi 85a6461
Improve types for Psalm and error's message improvement
iifawzi f5269d7
Adding more test cases
iifawzi 3516c94
Uncommenting tests
iifawzi 199ba66
updating comments
iifawzi cd49677
Explicitly check ON DUPLICATE KEY UPDATE and adding a test case
iifawzi f1585a9
Update the with Build statement to build the cteStatement
iifawzi bd86fb3
handle: cteStatementParser could be null
iifawzi c8f72ec
remove duplicated test
iifawzi File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do you know why it is reported non covered ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After 2 hours of investigation, It seems like it was always reporting false positive. it's A separate bug not related to the changes proposed in this PR, but it's now shown as uncovered because previously it wasn't in a separate branch:
sql-parser/src/Statements/CreateStatement.php
Lines 468 to 471 in ed0b4ba
The bug seems to be coming from this portion of code:
sql-parser/src/Statements/CreateStatement.php
Lines 699 to 718 in ed0b4ba
You will notice that after parsing the array options if exists, we update the
$list->idx
by these two lines of code:and that's totally fine, the issue is that in the code that follows, we're checking the keywords using the
$token
and the$nextidx
but their old state, which was set before updating the idx after parsing the options.sql-parser/src/Statements/CreateStatement.php
Lines 710 to 715 in ed0b4ba
so, we would need to update the
$token
and the$nextidx
to their new values corresponding to the update that occured after parsing the options.I will try to find sometime to fix it in the next weeks, but it has nothing to do with this PR.