You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ibatis.apache.org by "Ryan Yao (JIRA)" <ib...@incubator.apache.org> on 2005/04/05 22:42:23 UTC

[jira] Commented: (IBATISNET-27) Oracle Issues

     [ http://issues.apache.org/jira/browse/IBATISNET-27?page=comments#action_62212 ]
     
Ryan Yao commented on IBATISNET-27:
-----------------------------------

Right.... What I did for this issue is:

in the 
internal class BooleanTypeHandler : BaseTypeHandler
In the functions:

protected override object GetValueByName(ResultProperty mapping, IDataReader dataReader)
and
protected override object GetValueByIndex(ResultProperty mapping, IDataReader dataReader) 

Change From:

return dataReader.GetBoolean(index);

To:

if (dataReader.GetType() == typeof (System.Data.OracleClient.OracleDataReader))
{
return Convert.ToBoolean ( dataReader.GetInt32(index) );
}
else
{
return dataReader.GetBoolean(index);
}


Change From:

return dataReader.GetBoolean(mapping.ColumnIndex);

To:

if (dataReader.GetType() == typeof (System.Data.OracleClient.OracleDataReader))
{
return Convert.ToBoolean ( dataReader.GetInt32(mapping.ColumnIndex) );
}
else
{
return dataReader.GetBoolean(mapping.ColumnIndex);
}

> Oracle Issues
> -------------
>
>          Key: IBATISNET-27
>          URL: http://issues.apache.org/jira/browse/IBATISNET-27
>      Project: iBatis for .NET
>         Type: Improvement
>  Environment: vs 2003. Oracle 9i
>     Reporter: Ryan Yao

>
> Thank you guys hard working on iBatis, I really like it. 
> There are some issues I found in DataMapper
> 1: Oracle has limitation on any parameter names. Let's say, if you have an object property like:
> Customer.Address.ProvinceOrState.Country.Id, then your sqlParamName will be 
> :Customer_Address_ProvinceOrState_Country_Id  
> Oracle doesn't like parameter longer than 30 characters.
> So what I can do is:
> public class PreparedStatementFactory
> .....
> private void CreateParametersForStatementText()
> ...
> change 
> sqlParamName = _parameterPrefix + paramName;}
> to something like:
> if (_session.DataSource.Provider.Name.Substring(0,6).ToLower().Equals("oracle"))
> {sqlParamName = _parameterPrefix + "param" + v_i;}
> else
> {sqlParamName = _parameterPrefix + paramName;}
> so the parameters to ":param0,:param2......".
> There probably there are better ways to solve this, this is the way I am using for now.
> 2. Oracle data adapter does not take empty string(it will throw exceptions if you do so), it takes Null/Nothing or strings(but no string.empty or "").So, in 
> public class ParameterMap
> .....
> public object GetValueOfProperty(object source, string propertyName)
> ......
> after
> if (propertyValue == null)
> {
> 	propertyValue = DBNull.Value; ;
> }
> Added:
> else if (propertyValue.GetType() == typeof(string) && propertyValue.ToString() == "" )
> {
>         //Manually changed "" to DbNull
> 	propertyValue = DBNull.Value;
> }
> Thanks....

-- 
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