HHH-7716 Fixed a bug in CUBRIDLimitHandler. Now correctly processes

LIMIT
clause
in SQL.
This commit is contained in:
Esen Sagynov 2012-10-25 11:17:30 -04:00 committed by brmeyer
parent e7af2f4b76
commit 220365600c
1 changed files with 12 additions and 9 deletions

View File

@ -20,15 +20,18 @@ public class CUBRIDLimitHandler extends AbstractLimitHandler {
return true;
}
public boolean useMaxForLimit() {
return true;
}
public String getProcessedSql() {
boolean useLimitOffset = supportsLimit() && supportsLimitOffset()
&& LimitHelper.hasFirstRow( selection ) && LimitHelper.hasMaxRows( selection );
return dialect.getLimitString(
sql, useLimitOffset ? LimitHelper.getFirstRow( selection ) : 0, getMaxOrLimit()
);
if (LimitHelper.useLimit(this, selection)) {
// useLimitOffset: whether "offset" is set or not;
// if set, use "LIMIT offset, row_count" syntax;
// if not, use "LIMIT row_count"
boolean useLimitOffset = LimitHelper.hasFirstRow(selection);
return new StringBuilder(sql.length() + 20).append(sql)
.append(useLimitOffset ? " limit ?, ?" : " limit ?").toString();
}
else {
return sql; // or return unaltered SQL
}
}
}