[ 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/[email protected]/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
