| This implementation of LimitHandler is unable to handle one query with "order by" if there is a line break just before "order by" clause. In the method getProcessedSql(), line shallowIndexOfWord( sb, ORDER_BY, 0 ), but if fails if it faces a query like the one below:
SELECT * FROM (select NAME, PASSPORT FROM PERSON) X
ORDER BY X.NAME, X.PASSPORT;
Please, keep the line break after "X" above For this query, consider the following table:
CREATE TABLE PERSON
(
ID INT PRIMARY KEY,
NAME VARCHAR(255) NOT NULL,
PASSPORT varchar(255) NOT NULL
);
The problem is faced only if there's a RowSelection instance with firstRow > 0 as well as defined values for maxRows and fetchSize, e. g., pagination asking for page 2 or next. It throws one SQL One possible fix for this bug would be to replace first line (line 111) of SQLServer2005LimitHandler#getProcessedSQL() by:
final StringBuilder sb = new StringBuilder( sql.replaceAll( "\\r|\\n", " " ) );
, forcing the query to fit the format space + keyword * + *space and avoid line breaks. |