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 @@ public class SQLServer2005LimitHandler extends AbstractLimitHandler {
|
|||
|
||||
int depth = 0;
|
||||
int start = -1;
|
||||
boolean insideAStringValue = false;
|
||||
for ( int i = 0; i < sql.length(); ++i ) {
|
||||
final char ch = sql.charAt( i );
|
||||
if ( ch == '(' ) {
|
||||
if ( ch == '\'' ) {
|
||||
insideAStringValue = !insideAStringValue;
|
||||
}
|
||||
else if ( ch == '(' && !insideAStringValue ) {
|
||||
depth++;
|
||||
if ( depth == 1 ) {
|
||||
start = i;
|
||||
}
|
||||
}
|
||||
else if ( ch == ')' ) {
|
||||
else if ( ch == ')' && !insideAStringValue ) {
|
||||
if ( depth > 0 ) {
|
||||
if ( depth == 1 ) {
|
||||
ignoreRangeList.add( new IgnoreRange( start, i ) );
|
||||
|
|
Loading…
Reference in New Issue