Martin Tilsted created TORQUE-321: ------------------------------------- Summary: Wrong optimization of iLike without wildcards Key: TORQUE-321 URL: https://issues.apache.org/jira/browse/TORQUE-321 Project: Torque Issue Type: Bug Components: Runtime Affects Versions: 4.0 Environment: Using java 8 and Postgresql 9.3.4. Reporter: Martin Tilsted
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. -- This message was sent by Atlassian JIRA (v6.2#6252) --------------------------------------------------------------------- To unsubscribe, e-mail: torque-dev-unsubscr...@db.apache.org For additional commands, e-mail: torque-dev-h...@db.apache.org