Skip to content
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

HHH-18033 Fix LimitHandler detect wrong statement end if sql contains quoted semicolon #8270

Merged
merged 1 commit into from May 13, 2024

Conversation

quaff
Copy link
Contributor

@quaff quaff commented Apr 30, 2024

@quaff quaff changed the title HHH-18033 Fix AbstractLimitHandler detect wrong statement end if sql contains quoted semicolon HHH-18033 Fix LimitHandler detect wrong statement end if sql contains quoted semicolon Apr 30, 2024
@quaff
Copy link
Contributor Author

quaff commented May 6, 2024

@gavinking Please review.

* License: GNU Lesser General Public License (LGPL), version 2.1 or later
* See the lgpl.txt file in the root directory or http://www.gnu.org/licenses/lgpl-2.1.html
*/
package org.hibernate.community.dialect;
Copy link
Member

Choose a reason for hiding this comment

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

Shouldn't this be in a test package?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There are other tests already exist in this package, I think it's better to keep it.

Copy link
Member

Choose a reason for hiding this comment

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

Oh, well. That doesn't seem quite right to me.

@beikov is there a good reason the tests for the community dialects are in the same package as the dialect classes? Shouldn't they be somewhere like org.hibernate.community.dialect.test or whatever?

Copy link
Contributor

Choose a reason for hiding this comment

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

Having tests in the same package as the Dialect under test allows to test package-private methods, which I suppose was the original reason for doing this. When we moved the classes to the community dialects module, we didn't change the package for tests apparently. Either is fine IMO, though if you want to change it, I think I'd prefer the package you are proposing.

Copy link
Member

@gavinking gavinking left a comment

Choose a reason for hiding this comment

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

It looks fine, just a couple of minor comments.

@gavinking
Copy link
Member

I wonder if, since we're messing with this, we should also recognize line-ending comments of form -- text.

@quaff
Copy link
Contributor Author

quaff commented May 7, 2024

I wonder if, since we're messing with this, we should also recognize line-ending comments of form -- text.

I don't think people will pass such sql to entityManager.createNativeQuery().

@gavinking
Copy link
Member

I don't think people will pass such sql to entityManager.createNativeQuery().

Probably not, but they definitely might if it's a named query, especially one declared in XML.

@quaff
Copy link
Contributor Author

quaff commented May 7, 2024

I don't think people will pass such sql to entityManager.createNativeQuery().

Probably not, but they definitely might if it's a named query, especially one declared in XML.

Same as spaces, we should strip comments before reaching here, and it should be handled in another PR.

@gavinking
Copy link
Member

gavinking commented May 7, 2024

I wonder if, since we're messing with this, we should also recognize line-ending comments of form -- text.

Thinking this through, it's probably impossible to distinguish a line-ending comment from a quoted string literal containing the character sequence -- without a proper lexer.

So forget this suggestion.

@quaff quaff force-pushed the HHH-18033 branch 3 times, most recently from 957c6ad to 5bcaf53 Compare May 8, 2024 01:48
@quaff quaff marked this pull request as draft May 8, 2024 03:39
@quaff quaff force-pushed the HHH-18033 branch 3 times, most recently from 9ff5b0c to b9e23eb Compare May 8, 2024 04:26
@quaff
Copy link
Contributor Author

quaff commented May 8, 2024

Oracle12LimitHandler fixed also.

@quaff quaff marked this pull request as ready for review May 8, 2024 04:58
Copy link
Member

@gavinking gavinking left a comment

Choose a reason for hiding this comment

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

OK, great, thanks. Looks good now.

Appreciate your patience with my pickiness.

@beikov beikov merged commit df7f104 into hibernate:main May 13, 2024
22 of 23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants