DBNull.Value as parameter object raises NullReferenceException in 
UnknownTypeHandler
------------------------------------------------------------------------------------

         Key: IBATISNET-139
         URL: http://issues.apache.org/jira/browse/IBATISNET-139
     Project: iBatis for .NET
        Type: Bug
    Reporter: Ron Grabowski
 Assigned to: Ron Grabowski 
    Priority: Minor


This code from UnknownTypeHandler.cs:

 ITypeHandler handler = _factory.GetTypeHandler( parameterValue.GetType(), 
dbType );

raises a NullReferenceException if the parameterValue is DBNull.Value. Here's 
an example:

 // NullReferenceException
 sqlMapper.QueryForObject("User.Search", DBNull.Value);

There needs to be a DBNullTypeHandler class that translates DBNull.Value into 
null.

One of my co-workers called:

 // returns IList of IDictionary objects
 IList list = sqlMapper.QueryForList("User.Search", hashtable);

Using QuickWatch, I saw that one of the values in the IDictionary objects 
contained DBNull instead of null. How is DBNull being returned? I wasn't able 
to reproduce this behavior on my machine. He was running his query against a 
SQL Server 2000 database under .NET 1.1. 

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