[ 
http://issues.apache.org/jira/browse/IBATISNET-159?page=comments#action_12412390
 ] 

Jeremy Gray commented on IBATISNET-159:
---------------------------------------

Unless I'm mistaken, you are seeing correct behaviour. The isNotEqual prepend 
should only fire if a previous is* was satisfied and generated sql.

> 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/user-cs@ibatis.apache.org/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

Reply via email to