You are viewing a plain text version of this content. The canonical link for it is here.
Posted to torque-dev@db.apache.org by "Thomas Fox (JIRA)" <ji...@apache.org> on 2014/08/16 01:01:18 UTC

[jira] [Assigned] (TORQUE-321) Wrong optimization of iLike without wildcards

     [ https://issues.apache.org/jira/browse/TORQUE-321?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Thomas Fox reassigned TORQUE-321:
---------------------------------

    Assignee: Thomas Fox

> 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
>            Assignee: Thomas Fox
>
> 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-unsubscribe@db.apache.org
For additional commands, e-mail: torque-dev-help@db.apache.org