You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ibatis.apache.org by "Leonardo Holanda (JIRA)" <ib...@incubator.apache.org> on 2005/03/28 13:57:21 UTC

[jira] Commented: (IBATIS-95) Removal of extra OR/AND with parantheses ( ) with dynamic prepend!

     [ http://issues.apache.org/jira/browse/IBATIS-95?page=comments#action_61629 ]
     
Leonardo Holanda commented on IBATIS-95:
----------------------------------------

I don't think this is an improvement. It looks to be fix. Since dynamic SQL genaration statement is an iBatis feature, and it is not generating queries with correct syntax, it's a fix to a bug.

> Removal of extra OR/AND with parantheses ( ) with dynamic prepend!
> ------------------------------------------------------------------
>
>          Key: IBATIS-95
>          URL: http://issues.apache.org/jira/browse/IBATIS-95
>      Project: iBatis for Java
>         Type: Improvement
>   Components: SQL Maps
>  Environment: Not a issue.
>     Reporter: Erlend Bjørge

>
> Hi there!
> I have run into the same kind of problem as Brandon Goodin replied on:
> http://www.mail-archive.com/ibatis-user-java@incubator.apache.org/msg01403.html
> The problem is not just related to complex queries, but dealing with Dynamic prepend
> and parantheses, you will end up with a extra OR/AND you don't need in you query. 
> Simple as that.
> If you would have made the where clause by yourself, the simple solution is
> after you are finished with your  (OR .... OR ... OR) clause, just remove the 
> first OR/AND after ( and then your clause is correct. This is a simple solution,
> shouldn't it be possible with be possible with SQLMap tags too ??
> What about a new tag like ? (Hope this come out with correct linefeed :-)
> where clause bla bla ....
> <isParameterPresent>
>     AND (
>     <removeFirstPrependValue> 
>         <isNotNull prepend="OR".....> 
>         <isNotNull prepend="OR" ...> 
>         <isNotNull prepend="OR" ...> 
>     </removeFirstPrependValue>
>     )
> <isParameterPresent>
> Or similar function in the other tags like this as an extra parameter:
> where clause bla bla ....
> <isParameterPresent>
>     AND (
>   
>     <isNotNull prepend="OR" property="id"   removeFirstPrepend="true"> 
>     <isNotNull prepend="OR" property="name" removeFirstPrepend="true">
>     ) 
> <isParameterPresent>
> ??? Isn't that a nice new feature that will remove this kind of problem ?
> ---
> Thanks!
> Best regards,
> Erlend Bjørge

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira