[ http://issues.apache.org/jira/browse/IBATIS-95?page=all ] Clinton Begin closed IBATIS-95: -------------------------------
> 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 > Assignee: Brandon Goodin > Fix For: 2.1.0 > > 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 - For more information on JIRA, see: http://www.atlassian.com/software/jira
