mirror of
https://github.com/hibernate/hibernate-orm
synced 2025-02-17 16:44:57 +00:00
HHH-14649 Oracle limit handler create wrong sql query when multiple spaces are present in the query
(cherry picked from commit 8002b188bbb7f4c799ba1172db833827bb39c259)
This commit is contained in:
parent
8f21f9d701
commit
31ac883f36
@ -52,6 +52,7 @@ public String processSql(String sql, QueryParameters queryParameters) {
|
||||
if ( !hasMaxRows ) {
|
||||
return sql;
|
||||
}
|
||||
sql = sql.trim();
|
||||
|
||||
final LockOptions lockOptions = queryParameters.getLockOptions();
|
||||
if ( lockOptions != null ) {
|
||||
@ -83,7 +84,6 @@ private String processSqlOffsetFetch(String sql, boolean hasFirstRow) {
|
||||
bindLimitParametersInReverseOrder = false;
|
||||
useMaxForLimit = false;
|
||||
|
||||
sql = normalizeStatement( sql );
|
||||
final int offsetFetchLength;
|
||||
final String offsetFetchString;
|
||||
if ( hasFirstRow ) {
|
||||
@ -100,7 +100,6 @@ private String processSqlOffsetFetch(String sql, boolean hasFirstRow) {
|
||||
private String processSql(String sql, int forUpdateIndex, boolean hasFirstRow) {
|
||||
bindLimitParametersInReverseOrder = true;
|
||||
useMaxForLimit = true;
|
||||
sql = normalizeStatement( sql );
|
||||
|
||||
String forUpdateClause = null;
|
||||
boolean isForUpdate = false;
|
||||
@ -142,10 +141,6 @@ private String processSql(String sql, int forUpdateIndex, boolean hasFirstRow) {
|
||||
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';
|
||||
|
Loading…
x
Reference in New Issue
Block a user