Skip to content

Add Delete / Update modifiers for MySQL #1254 #1396

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

Merged

Conversation

OlivierCavadenti
Copy link
Contributor

UPDATE IGNORE table1 A SET A.columna = 'XXX'
DELETE IGNORE FROM tablename

UPDATE LOW_PRIORITY table1 A SET A.columna = 'XXX'
DELETE LOW_PRIORITY FROM tablename
DELETE QUICK FROM tablename

startJoins=JoinsList()

<K_UPDATE> { update.setOracleHint(getOracleHint()); }
[(tk = <K_LOW_PRIORITY>)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pardon me, I do not understand that line: would the token not always be "LOW_PRIORITY" and so modifierPriority = UpdateModifierPriority.LOW_PRIORITY?

Why would we not write this as

[ <K_LOW_PRIORITY> { modifierPriority = UpdateModifierPriority.LOW_PRIORITY; } ]

Am I missing something please?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I fix that ok. I copy the logic from INSERT priority but they have more values...

Copy link
Contributor

@manticore-projects manticore-projects Nov 1, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apologies, I was not verbose enough. You can replace:

[(tk = <K_LOW_PRIORITY>)
    {if (tk!=null)
        modifierPriority = DeleteModifierPriority.LOW_PRIORITY;
    }]

with a simple

[ <K_LOW_PRIORITY> { modifierPriority = UpdateModifierPriority.LOW_PRIORITY; } ]

Just showing the possibilities, you can leave as it is and let the compiler do the work.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My fault sry ^^. Do I need something in this PR regarding your comment here ? #1382 (comment)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do I need something in this PR regarding your comment here ? #1382 (comment)

No, you did good.
I just used your contribution as an example, why we need to work on the Reserved Keyword Management in general and it is not certain, if @wumpz will like my idea. If he does, then your new token QUICK will be handled automatically. If he does not, we can add it any time later to the Allowed Keywords.

Managing Reserved Keywords in a JavaCC Grammar is a bit weird and not straight forward.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok no problem, thanks for the review anyway.

@manticore-projects
Copy link
Contributor

Thank you so much for the contribution, good stuff!
Please consider 2 amendments:

  1. I left a comment on a possible code simplification, if my assumption was wrong please disregard

  2. more importantly: the PR fails the CI Test as shown in https://app.codacy.com/gh/JSQLParser/JSqlParser/pullRequest?prid=8341437
    It is mostly on Code Style and annoying stuff, but important for house keeping. Please clean out this list and push the changes. Thank you!

@wumpz wumpz merged commit 7be5d8e into JSQLParser:master Nov 19, 2021
@OlivierCavadenti OlivierCavadenti deleted the update-delete-modifiers-1254 branch November 19, 2021 21:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Update ignore and delete ignore not parseable
3 participants