[ http://issues.apache.org/jira/browse/IBATISNET-159?page=comments#action_12412395 ]
Michael Schall commented on IBATISNET-159: ------------------------------------------ In my example if I pass in "XYZ" as LocationCode, the "and" should be prepended correct? isNotNull would be true and isNotEqual would be true for "%". Am I not combining these correctly? How else can I do a complex compare? If I'm wrong on the first part of the clause, please let me know. However even the later simple conditions need the prepend removed and added in the tag or an error will be thrown as an invalid sql statement. Thanks for your time. Mike > prepends are not working in some cases > -------------------------------------- > > Key: IBATISNET-159 > URL: http://issues.apache.org/jira/browse/IBATISNET-159 > Project: iBatis for .NET > Type: Bug > Components: DataMapper > Versions: DataMapper 1.3 > Environment: Win2000 Server, WinXP .Net Framework 2.0 > Reporter: Michael Schall > > I have posted a question to the newsgroup. > http://www.mail-archive.com/[email protected]/msg00874.html > In certain cases the prepend is not working correctly. > I get a "sql error > near tp_Calls". The prepends aren't adding in the "and" to the > resultant sql string. > <dynamic prepend="WHERE"> > <![CDATA[ > OffHookDt <= #EndDate# AND > OffHookDt >= #StartDate# > ]]> > <isNotNull property="LocationCode"> > <isNotEqual prepend="and" property="LocationCode" > compareValue="%"> > tp_Calls.LocationCd = #LocationCode# > </isNotEqual> > </isNotNull> > <isNotEqual prepend="and" property="RateType" compareValue="-1"> > RateType = #RateType# > </isNotEqual> > <isEqual prepend="and" property="PrivateAllowed" compareValue="0"> > tp_Calls.Hidden = 0 > </isEqual> > </dynamic> > If I change it to the following everything works great. > <dynamic prepend="WHERE"> > <![CDATA[ > OffHookDt <= #EndDate# AND > OffHookDt >= #StartDate# > ]]> > <isNotNull property="LocationCode"> > <isNotEqual property="LocationCode" compareValue="%"> > and tp_Calls.LocationCd = #LocationCode# > </isNotEqual> > </isNotNull> > <isNotEqual property="RateType" compareValue="-1"> > and RateType = #RateType# > </isNotEqual> > <isEqual property="PrivateAllowed" compareValue="0"> > and tp_Calls.Hidden = 0 > </isEqual> > </dynamic> -- 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
