[
https://issues.apache.org/jira/browse/OFBIZ-1045?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Luke Prentice updated OFBIZ-1045:
---------------------------------
Attachment: all-app-framework-EntityOperator.java.diff
patch for 4955
this adds a new constructor for the BETWEEN operator
public static final EntityComparisonOperator BETWEEN = new
EntityComparisonOperator(ID_BETWEEN, "BETWEEN") {
public boolean compare(Object lhs, Object rhs) { return
EntityComparisonOperator.compareIn(lhs, rhs); }
protected void makeRHSWhereStringValue(ModelEntity entity, List
entityConditionParams, StringBuffer sb, ModelField field, Object rhs) {
appendRHSBetweenList(entityConditionParams, sb, field, rhs); }
};
static { register( "between", BETWEEN ); }
with an associated helper method appendRHSBetweenList()
protected void appendRHSBetweenList(List entityConditionParams,
StringBuffer whereStringBuffer, ModelField field, Object rhs) {
if (rhs instanceof Collection) {
Iterator rhsIter = ((Collection) rhs).iterator();
while (rhsIter.hasNext()) {
Object inObj = rhsIter.next();
addValue(whereStringBuffer, field, inObj,
entityConditionParams);
if (rhsIter.hasNext()) {
whereStringBuffer.append(" AND ");
}
}
} else {
addValue(whereStringBuffer, field, rhs, entityConditionParams);
}
}
> EntityOperator does not correctly construct SQL for BETWEEN clause
> ------------------------------------------------------------------
>
> Key: OFBIZ-1045
> URL: https://issues.apache.org/jira/browse/OFBIZ-1045
> Project: OFBiz (The Open for Business Project)
> Issue Type: Bug
> Components: framework
> Affects Versions: SVN trunk
> Environment: ubuntu 7.04, postgres 8.2, working with SVN release
> 4955, but EntityOperator.java has not changed since then.
> Reporter: Luke Prentice
> Attachments: all-app-framework-EntityOperator.java.diff
>
>
> when using the BETWEEN EntityOperator the SQL produced is incorrectly
> formatted:
> ... field1 BETWEEN (value1, value2)
> it should be
> ... field1 BETWEEN value1 AND value2
> this produces an SQL parse exception.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.