db-torque-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Thomas Fox (JIRA)" <j...@apache.org>
Subject [jira] [Resolved] (TORQUE-321) Wrong optimization of iLike without wildcards
Date Wed, 03 Sep 2014 19:53:52 GMT

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

Thomas Fox resolved TORQUE-321.
-------------------------------
       Resolution: Fixed
    Fix Version/s: 4.1

> 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
>             Fix For: 4.1
>
>
> 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.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: torque-dev-unsubscribe@db.apache.org
For additional commands, e-mail: torque-dev-help@db.apache.org


Mime
View raw message