Generate valid SQL when firstRow is set but not maxRows

This commit is contained in:
Tobias
2013-10-07 16:29:23 +02:00
parent 09ea5217dc
commit 1330fe8fb6
2 changed files with 88 additions and 12 deletions
@@ -31,13 +31,12 @@ public class LimitOffsetSqlLimiter implements SqlLimiter {
maxRows = maxRows + 1;
}
sb.append(" ").append(NEW_LINE).append(LIMIT).append(" ");
if (maxRows > 0) {
sb.append(maxRows);
}
if (firstRow > 0) {
sb.append(" ").append(OFFSET).append(" ");
sb.append(firstRow);
if (maxRows > 0 || firstRow > 0) {
sb.append(" ").append(NEW_LINE).append(LIMIT).append(" ").append(maxRows);
if (firstRow > 0) {
sb.append(" ").append(OFFSET).append(" ");
sb.append(firstRow);
}
}
String sql = request.getDbPlatform().completeSql(sb.toString(), request.getOrmQuery());