Skip to content
Browse files

Fixed a bug in CUBRIDLimitHandler. Now correctly processes LIMIT clau…

…se in SQL.
  • Loading branch information...
1 parent 005cae5 commit 9a4fb4e746c16f4d7071c81475b44e6b96806a37 @kadishmal kadishmal committed Aug 29, 2012
View
21 hibernate-core/src/main/java/org/hibernate/dialect/pagination/CUBRIDLimitHandler.java
@@ -20,15 +20,18 @@ public boolean supportsLimit() {
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
+ }
}
}

0 comments on commit 9a4fb4e

Please sign in to comment.
Something went wrong with that request. Please try again.