Revert "HHH-14649 Oracle limit handler create wrong sql query when multiple spaces are present in the query"

This reverts commit 31ac883f36.
This commit is contained in:
Gail Badner 2021-09-29 09:16:45 -07:00
parent 31ac883f36
commit c5bc1f2884
1 changed files with 6 additions and 1 deletions

View File

@ -52,7 +52,6 @@ public class Oracle12LimitHandler extends AbstractLimitHandler {
if ( !hasMaxRows ) {
return sql;
}
sql = sql.trim();
final LockOptions lockOptions = queryParameters.getLockOptions();
if ( lockOptions != null ) {
@ -84,6 +83,7 @@ public class Oracle12LimitHandler extends AbstractLimitHandler {
bindLimitParametersInReverseOrder = false;
useMaxForLimit = false;
sql = normalizeStatement( sql );
final int offsetFetchLength;
final String offsetFetchString;
if ( hasFirstRow ) {
@ -100,6 +100,7 @@ public class Oracle12LimitHandler extends AbstractLimitHandler {
private String processSql(String sql, int forUpdateIndex, boolean hasFirstRow) {
bindLimitParametersInReverseOrder = true;
useMaxForLimit = true;
sql = normalizeStatement( sql );
String forUpdateClause = null;
boolean isForUpdate = false;
@ -141,6 +142,10 @@ public class Oracle12LimitHandler extends AbstractLimitHandler {
return pagingSelect.toString();
}
private String normalizeStatement(String sql) {
return sql.trim().replaceAll( "\\s+", " " );
}
private int getForUpdateIndex(String sql) {
final int forUpdateLastIndex = sql.toLowerCase( Locale.ROOT ).lastIndexOf( "for update" );
// We need to recognize cases like : select a from t where b = 'for update';