HHH-7716 Fixed a bug in CUBRIDLimitHandler. Now correctly processes
LIMIT clause in SQL.
This commit is contained in:
parent
e7af2f4b76
commit
220365600c
|
@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue