Details
Description
Torque transform a criteria with SqlEnum.ILIKE to a simple compare using(=) if the string it searches for don't contain any wildcards.
But this optimization is not valid, because ILIKE also does a case insensitive compare. This bug causes ILIKE to behave like LIKE when not using any wildcards.
Example code:
Criteria c=new Criteria();
c.and(VoucherinstancePeer.CODE,"myCode",SqlEnum.ILIKE);
log.debug("Got criteria=" + c);
c=new Criteria();
c.and(VoucherinstancePeer.CODE,"myCode%",SqlEnum.ILIKE);
log.debug("Got criteria=" + c);
Gives this output:
DEBUG - Got criteria=Criteria: Current Query SQL (may not be complete or applicable): SELECT FROM voucherInstance WHERE voucherInstance.code=? Replacements: [myCode]
DEBUG - Got criteria=Criteria: Current Query SQL (may not be complete or applicable): SELECT FROM voucherInstance WHERE voucherInstance.code ILIKE ? Replacements: [myCode%]
where the invalid transformation can be seen.