[ http://issues.apache.org/jira/browse/IBATISNET-30?page=comments#action_65456 ] Roberto Rabe commented on IBATISNET-30: ---------------------------------------
MSSQL ODBC/OLEDB/SqlClient, MySQL ByteFX, and MS OracleClient pass NUnit tests. ODP.NET 10g provider needs additional fix: In ODP.NET 10g, there is a property of the OracleCommand class called BindByName. This needs to be set to true when the same parameter is used multiple times the way it is in the NUnit JIRA 30 test. See the following: http://tinyurl.com/8a877 http://forums.oracle.com/forums/thread.jsp?forum=146&thread=235063&message=669050&q=6e6f7420616c6c207661726961626c657320626f756e64#669050 Yes, ODP binds by position by default, but we need to name the parameters like ":1" vs "?" in OLEDB: http://tinyurl.com/9frd8 http://forums.oracle.com/forums/thread.jsp?forum=146&thread=54730&message=54730&q=706f736974696f6e616c2062696e64696e67#54730 http://tinyurl.com/baoqy http://forums.oracle.com/forums/thread.jsp?forum=146&thread=278151&message=866549&q=6e6f7420616c6c207661726961626c657320626f756e64#866549 Therefore, providers.config has been using usePositionalParameters = "false" for the ODP.NET provider due to the naming. Unfortunately in this case, since OracleCommand.BindByName is not being set, this test case fails because of the repetition of the parameter. To get this to work with ODP.NET, we can change the providers.config entry to usePositionalParameters = "true" and rework PreparedStatementFactory.EvaluateParameterMap when it checks usePositionalParameters to something like this: if (_session.DataSource.Provider.UsePositionalParameters) { // ODP.NET uses positional parameters but needs "name" if (_parameterPrefix.Equals(":")) { sqlParamName = ":" + index; } else { // OLEDB/OBDC doesn't support named parameters !!! sqlParamName = "?"; } } > bug in ApplyParameterMap > ------------------------ > > Key: IBATISNET-30 > URL: http://issues.apache.org/jira/browse/IBATISNET-30 > Project: iBatis for .NET > Type: Bug > Versions: DataMapper 1.2 > Reporter: Jakob Rojel > Assignee: Gilles Bayon > Fix For: DataMapper 1.2 > > If my XML file contains > <isNotNull prepend="and" property="NumberSearch"> > ((inline.order_number $Number_Oper$ #NumberSearch#) or > (inline.invoice_number $Number_Oper$ #NumberSearch#)) > </isNotNull> > <isEqual prepend = "and" property="InvoiceStatusAnd" > compareValue="true"> > (inline.invoice_state = #InvoiceStatus#) > </isEqual> > <isEqual prepend = "and" property="OrderStatusAnd" compareValue="true"> > (inline.order_state = #OrderStatus#) > </isEqual> > My parameter for NumberSearch is copied into InvoiceStatus, the following > works. > <isEqual prepend = "and" property="InvoiceStatusAnd" > compareValue="true"> > (inline.invoice_state = #InvoiceStatus#) > </isEqual> > <isEqual prepend = "and" property="OrderStatusAnd" compareValue="true"> > (inline.order_state = #OrderStatus#) > </isEqual> > <isNotNull prepend="and" property="NumberSearch"> > ((inline.order_number $Number_Oper$ #NumberSearch#) or > (inline.invoice_number $Number_Oper$ #NumberSearch#)) > </isNotNull> > My pretty sure that that the problem is related to the fact that NumberSearch > is used twice > When I debug the following code in ApplyParameterMap > if ( propertyName != "value" ) // Inline Parameters && > Parameters via ParameterMap > { > ParameterProperty property = > request.ParameterMap.GetProperty(i); > sqlParameter.Value = > request.ParameterMap.GetValueOfProperty(parameterObject, > > property.PropertyName); > } > propertyName is InvoiceStatus and property.PropertyName is NumberSearch > -- 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