Author: doogie
Date: Mon Aug 2 17:42:28 2010
New Revision: 981622
URL:
http://svn.apache.org/viewvc?rev=981622&view=revLog:
BUG FIX: OFFSET/LIMIT have to be after ORDER BY/GROUP BY.
Modified:
ofbiz/trunk/framework/sql/src/org/ofbiz/sql/SQLSelect.java
Modified: ofbiz/trunk/framework/sql/src/org/ofbiz/sql/SQLSelect.java
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/framework/sql/src/org/ofbiz/sql/SQLSelect.java?rev=981622&r1=981621&r2=981622&view=diff==============================================================================
--- ofbiz/trunk/framework/sql/src/org/ofbiz/sql/SQLSelect.java (original)
+++ ofbiz/trunk/framework/sql/src/org/ofbiz/sql/SQLSelect.java Mon Aug 2 17:42:28 2010
@@ -146,12 +146,6 @@ public final class SQLSelect extends SQL
sb.append(" HAVING ");
havingCondition.appendTo(sb);
}
- if (offset != -1) {
- sb.append(" OFFSET ").append(offset);
- }
- if (limit != -1) {
- sb.append(" LIMIT ").append(limit);
- }
if (groupBy != null) {
sb.append(" GROUP BY ");
StringUtil.append(sb, groupBy, null, null, ", ");
@@ -160,6 +154,12 @@ public final class SQLSelect extends SQL
sb.append(" ORDER BY ");
StringUtil.append(sb, orderBy, null, null, ", ");
}
+ if (offset != -1) {
+ sb.append(" OFFSET ").append(offset);
+ }
+ if (limit != -1) {
+ sb.append(" LIMIT ").append(limit);
+ }
sb.append(';');
return sb;
}