mirror of
https://github.com/hibernate/hibernate-orm
synced 2025-02-10 05:04:52 +00:00
HHH-11650 - Parenthesis are interpreted in WHERE conditions when using paging and SQL Server
This commit is contained in:
parent
17fd76ad21
commit
f9231bed0d
@ -387,15 +387,19 @@ private static List<IgnoreRange> generateIgnoreRanges(String sql) {
|
|||||||
|
|
||||||
int depth = 0;
|
int depth = 0;
|
||||||
int start = -1;
|
int start = -1;
|
||||||
|
boolean insideAStringValue = false;
|
||||||
for ( int i = 0; i < sql.length(); ++i ) {
|
for ( int i = 0; i < sql.length(); ++i ) {
|
||||||
final char ch = sql.charAt( i );
|
final char ch = sql.charAt( i );
|
||||||
if ( ch == '(' ) {
|
if ( ch == '\'' ) {
|
||||||
|
insideAStringValue = !insideAStringValue;
|
||||||
|
}
|
||||||
|
else if ( ch == '(' && !insideAStringValue ) {
|
||||||
depth++;
|
depth++;
|
||||||
if ( depth == 1 ) {
|
if ( depth == 1 ) {
|
||||||
start = i;
|
start = i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if ( ch == ')' ) {
|
else if ( ch == ')' && !insideAStringValue ) {
|
||||||
if ( depth > 0 ) {
|
if ( depth > 0 ) {
|
||||||
if ( depth == 1 ) {
|
if ( depth == 1 ) {
|
||||||
ignoreRangeList.add( new IgnoreRange( start, i ) );
|
ignoreRangeList.add( new IgnoreRange( start, i ) );
|
||||||
|
Loading…
x
Reference in New Issue
Block a user