Hello,
I use Cayenne (and MySql) and the filter is malfunctioning:
There is a problem with CayenneUtils.java : Sql parameters are shifted, and ALL clauses "AND" and "OR" must be in lowercase
It seems to be missing 2 instructions "num++" after lines 162 and 173
public static SelectQuery applyFiltersAndSorter(
...
for(int j=0;j<inValues.size();j++) {
baseSQL +=
attributeName +
" " + filterClauses[1].getOperator() +
" $n"+num+" OR "; // <--- lowercase
values.put("n"+num,inValues.get(j));
num++; // <--------- missing here
}
baseSQL = baseSQL.substring(0,baseSQL.length()-3);
baseSQL += ") AND "; // <--- lowercase
}
} else {
// name op value
baseSQL +=
attributeName +
" " + filterClauses[1].getOperator() +
" $n"+num+" AND "; // <--- lowercase
values.put("n"+num,filterClauses[1].getValue());
num++; // <--------- missing here
}
....
GG
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello,
I use Cayenne (and MySql) and the filter is malfunctioning:
There is a problem with CayenneUtils.java : Sql parameters are shifted, and ALL clauses "AND" and "OR" must be in lowercase
It seems to be missing 2 instructions "num++" after lines 162 and 173
public static SelectQuery applyFiltersAndSorter(
...
for(int j=0;j<inValues.size();j++) {
baseSQL +=
attributeName +
" " + filterClauses[1].getOperator() +
" $n"+num+" OR "; // <--- lowercase
values.put("n"+num,inValues.get(j));
num++; // <--------- missing here
}
baseSQL = baseSQL.substring(0,baseSQL.length()-3);
baseSQL += ") AND "; // <--- lowercase
}
} else {
// name op value
baseSQL +=
attributeName +
" " + filterClauses[1].getOperator() +
" $n"+num+" AND "; // <--- lowercase
values.put("n"+num,filterClauses[1].getValue());
num++; // <--------- missing here
}
....
GG
Thanks for reporting me this bug and corrections!
I'll include them in next release of OpenSwing, planned for next monday.