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

Reply via email to