Menu

Bug in CayenneUtils ?

Help
Marsouin
2009-02-28
2012-12-13
  • Marsouin

    Marsouin - 2009-02-28

    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

     
    • mcarniel

      mcarniel - 2009-03-14

      Thanks for reporting me this bug and corrections!
      I'll include them in next release of OpenSwing, planned for next monday.

       

Log in to post a comment.