protected sealed override object ConvertValue(object value)
{
// can not convert null or DbNull to other types
if (value == null || value == DBNull.Value)
{
return(value);
}
// TBD : some other way to do this?
// if (OracleType == OracleType.Binary) {
// return value;
// }
// .NET throws an exception to the user.
object convertedValue = value;
// note : if we set user parameter jdbc type inside prepare interbal, the db type is not set
if (value is IConvertible && (IsDbTypeSet || IsJdbcTypeSet))
{
OracleType oleDbType = (IsDbTypeSet) ? OracleType : OracleConvert.JdbcTypeToOracleType((int)JdbcType);
Type to = OracleConvert.OracleTypeToValueType(oleDbType);
if (!(value is DateTime && to == OracleConvert.TypeOfTimespan)) //anyway will go by jdbc type
{
convertedValue = Convert.ChangeType(value, to);
}
}
return(convertedValue);
}