Author: rgrabowski
Date: Sun Feb 19 15:23:18 2006
New Revision: 378979
URL: http://svn.apache.org/viewcvs?rev=378979&view=rev
Log:
Fix for IBATISNET-139 to prevent NullReferenceException when DBNull.Value is
inside an IDictionary parameter object.
Added:
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/DBNullTypeHandler.cs
Modified:
ibatis/trunk/cs/mapper/ (props changed)
ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/IBatisNet.DataMapper.Test.csproj
ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/bin/Debug/SqlMap_Access_OleDb.config
ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/bin/Debug/SqlMap_MSSQL_Odbc.config
ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/bin/Debug/SqlMap_MSSQL_OleDb.config
ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/bin/Debug/SqlMap_MSSQL_SqlClient.config
ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/bin/Debug/SqlMap_MySql_ByteFx.config
ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/bin/Debug/SqlMap_MySql_MySql.config
ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/bin/Debug/SqlMap_Oracle_ODP.config
ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/bin/Debug/SqlMap_Oracle_OracleClient.config
ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/bin/Debug/SqlMap_PostgreSQL_Npgsql.config
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/IBatisNet.DataMapper.csproj
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/TypeHandlerFactory.cs
Propchange: ibatis/trunk/cs/mapper/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Sun Feb 19 15:23:18 2006
@@ -5,3 +5,4 @@
_ReSharper.DataAccess
_ReSharper.IBatisNet
build
+_ReSharper.DataMapper.2005
Modified:
ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/IBatisNet.DataMapper.Test.csproj
URL:
http://svn.apache.org/viewcvs/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/IBatisNet.DataMapper.Test.csproj?rev=378979&r1=378978&r2=378979&view=diff
==============================================================================
---
ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/IBatisNet.DataMapper.Test.csproj
(original)
+++
ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/IBatisNet.DataMapper.Test.csproj
Sun Feb 19 15:23:18 2006
@@ -364,6 +364,10 @@
BuildAction = "Content"
/>
<File
+ RelPath = "Maps\Access\OleDb\ParameterClass.xml"
+ BuildAction = "Content"
+ />
+ <File
RelPath = "Maps\Access\OleDb\ResultClass.xml"
BuildAction = "Content"
/>
@@ -404,6 +408,10 @@
BuildAction = "Content"
/>
<File
+ RelPath = "Maps\MSSQL\Odbc\ParameterClass.xml"
+ BuildAction = "Content"
+ />
+ <File
RelPath = "Maps\MSSQL\Odbc\ResultClass.xml"
BuildAction = "Content"
/>
@@ -444,6 +452,10 @@
BuildAction = "Content"
/>
<File
+ RelPath = "Maps\MSSQL\OleDb\ParameterClass.xml"
+ BuildAction = "Content"
+ />
+ <File
RelPath = "Maps\MSSQL\OleDb\ResultClass.xml"
BuildAction = "Content"
/>
@@ -488,6 +500,10 @@
BuildAction = "Content"
/>
<File
+ RelPath = "Maps\MSSQL\SqlClient\ParameterClass.xml"
+ BuildAction = "Content"
+ />
+ <File
RelPath = "Maps\MSSQL\SqlClient\ResultClass.xml"
BuildAction = "Content"
/>
@@ -528,6 +544,10 @@
BuildAction = "Content"
/>
<File
+ RelPath = "Maps\MySql\ByteFx\ParameterClass.xml"
+ BuildAction = "Content"
+ />
+ <File
RelPath = "Maps\MySql\ByteFx\ResultClass.xml"
BuildAction = "Content"
/>
@@ -568,6 +588,10 @@
BuildAction = "Content"
/>
<File
+ RelPath = "Maps\MySql\MySql\ParameterClass.xml"
+ BuildAction = "Content"
+ />
+ <File
RelPath = "Maps\MySql\MySql\ResultClass.xml"
BuildAction = "Content"
/>
@@ -608,6 +632,10 @@
BuildAction = "Content"
/>
<File
+ RelPath = "Maps\Oracle\ODP\ParameterClass.xml"
+ BuildAction = "Content"
+ />
+ <File
RelPath = "Maps\Oracle\ODP\ResultClass.xml"
BuildAction = "Content"
/>
@@ -648,6 +676,10 @@
BuildAction = "Content"
/>
<File
+ RelPath = "Maps\Oracle\OracleClient\ParameterClass.xml"
+ BuildAction = "Content"
+ />
+ <File
RelPath = "Maps\Oracle\OracleClient\ResultClass.xml"
BuildAction = "Content"
/>
@@ -688,6 +720,10 @@
BuildAction = "Content"
/>
<File
+ RelPath = "Maps\PostgreSQL\Npgsql\ParameterClass.xml"
+ BuildAction = "Content"
+ />
+ <File
RelPath = "Maps\PostgreSQL\Npgsql\ResultClass.xml"
BuildAction = "Content"
/>
@@ -728,6 +764,11 @@
/>
<File
RelPath = "NUnit\SqlMapTests\InheritanceTest.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "NUnit\SqlMapTests\ParameterClass.cs"
SubType = "Code"
BuildAction = "Compile"
/>
Modified:
ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/bin/Debug/SqlMap_Access_OleDb.config
URL:
http://svn.apache.org/viewcvs/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/bin/Debug/SqlMap_Access_OleDb.config?rev=378979&r1=378978&r2=378979&view=diff
==============================================================================
---
ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/bin/Debug/SqlMap_Access_OleDb.config
(original)
+++
ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/bin/Debug/SqlMap_Access_OleDb.config
Sun Feb 19 15:23:18 2006
@@ -34,6 +34,7 @@
<sqlMap resource="../../Maps/Access/OleDb/Enumeration.xml"/>
<sqlMap resource="../../Maps/Access/OleDb/Other.xml"/>
<sqlMap resource="../../Maps/Access/OleDb/Document.xml"/>
+ <sqlMap resource="../../Maps/Access/OleDb/ParameterClass.xml"/>
<sqlMap resource="../../Maps/Access/OleDb/ResultClass.xml"/>
</sqlMaps>
Modified:
ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/bin/Debug/SqlMap_MSSQL_Odbc.config
URL:
http://svn.apache.org/viewcvs/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/bin/Debug/SqlMap_MSSQL_Odbc.config?rev=378979&r1=378978&r2=378979&view=diff
==============================================================================
---
ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/bin/Debug/SqlMap_MSSQL_Odbc.config
(original)
+++
ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/bin/Debug/SqlMap_MSSQL_Odbc.config
Sun Feb 19 15:23:18 2006
@@ -38,6 +38,7 @@
<sqlMap resource="../../Maps/MSSQL/Odbc/LineItem.xml"/>
<sqlMap resource="../../Maps/MSSQL/Odbc/Enumeration.xml"/>
<sqlMap resource="../../Maps/MSSQL/Odbc/Other.xml"/>
+ <sqlMap resource="../../Maps/MSSQL/Odbc/ParameterClass.xml"/>
<sqlMap resource="../../Maps/MSSQL/Odbc/ResultClass.xml"/>
<sqlMap resource="../../Maps/MSSQL/Odbc/Document.xml"/>
</sqlMaps>
Modified:
ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/bin/Debug/SqlMap_MSSQL_OleDb.config
URL:
http://svn.apache.org/viewcvs/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/bin/Debug/SqlMap_MSSQL_OleDb.config?rev=378979&r1=378978&r2=378979&view=diff
==============================================================================
---
ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/bin/Debug/SqlMap_MSSQL_OleDb.config
(original)
+++
ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/bin/Debug/SqlMap_MSSQL_OleDb.config
Sun Feb 19 15:23:18 2006
@@ -37,6 +37,7 @@
<sqlMap resource="../../Maps/MSSQL/OleDb/LineItem.xml"/>
<sqlMap resource="../../Maps/MSSQL/OleDb/Enumeration.xml"/>
<sqlMap resource="../../Maps/MSSQL/OleDb/Other.xml"/>
+ <sqlMap resource="../../Maps/MSSQL/OleDb/ParameterClass.xml"/>
<sqlMap resource="../../Maps/MSSQL/OleDb/ResultClass.xml"/>
<sqlMap resource="../../Maps/MSSQL/OleDb/Document.xml"/>
</sqlMaps>
Modified:
ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/bin/Debug/SqlMap_MSSQL_SqlClient.config
URL:
http://svn.apache.org/viewcvs/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/bin/Debug/SqlMap_MSSQL_SqlClient.config?rev=378979&r1=378978&r2=378979&view=diff
==============================================================================
---
ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/bin/Debug/SqlMap_MSSQL_SqlClient.config
(original)
+++
ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/bin/Debug/SqlMap_MSSQL_SqlClient.config
Sun Feb 19 15:23:18 2006
@@ -38,6 +38,7 @@
<sqlMap resource="../../Maps/MSSQL/SqlClient/LineItem.xml"/>
<sqlMap resource="../../Maps/MSSQL/SqlClient/Enumeration.xml"/>
<sqlMap resource="../../Maps/MSSQL/SqlClient/Other.xml"/>
+ <sqlMap
resource="../../Maps/MSSQL/SqlClient/ParameterClass.xml"/>
<sqlMap resource="../../Maps/MSSQL/SqlClient/ResultClass.xml"/>
<sqlMap resource="../../Maps/MSSQL/SqlClient/Document.xml"/>
<sqlMap
resource="../../Maps/MSSQL/SqlClient/EmbedParameter.xml"/>
Modified:
ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/bin/Debug/SqlMap_MySql_ByteFx.config
URL:
http://svn.apache.org/viewcvs/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/bin/Debug/SqlMap_MySql_ByteFx.config?rev=378979&r1=378978&r2=378979&view=diff
==============================================================================
---
ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/bin/Debug/SqlMap_MySql_ByteFx.config
(original)
+++
ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/bin/Debug/SqlMap_MySql_ByteFx.config
Sun Feb 19 15:23:18 2006
@@ -37,6 +37,7 @@
<sqlMap resource="../../Maps/MySql/ByteFx/LineItem.xml"/>
<sqlMap resource="../../Maps/MySql/ByteFx/Enumeration.xml"/>
<sqlMap resource="../../Maps/MySql/ByteFx/Other.xml"/>
+ <sqlMap resource="../../Maps/MySql/ByteFx/ParameterClass.xml"/>
<sqlMap resource="../../Maps/MySql/ByteFx/ResultClass.xml"/>
<sqlMap resource="../../Maps/MySql/ByteFx/Document.xml"/>
<!-- Rem : If used as embbeded Resources, use
Modified:
ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/bin/Debug/SqlMap_MySql_MySql.config
URL:
http://svn.apache.org/viewcvs/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/bin/Debug/SqlMap_MySql_MySql.config?rev=378979&r1=378978&r2=378979&view=diff
==============================================================================
---
ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/bin/Debug/SqlMap_MySql_MySql.config
(original)
+++
ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/bin/Debug/SqlMap_MySql_MySql.config
Sun Feb 19 15:23:18 2006
@@ -37,6 +37,7 @@
<sqlMap resource="../../Maps/MySql/MySql/LineItem.xml"/>
<sqlMap resource="../../Maps/MySql/MySql/Enumeration.xml"/>
<sqlMap resource="../../Maps/MySql/MySql/Other.xml"/>
+ <sqlMap resource="../../Maps/MySql/MySql/ParameterClass.xml"/>
<sqlMap resource="../../Maps/MySql/MySql/ResultClass.xml"/>
<sqlMap resource="../../Maps/MySql/MySql/Document.xml"/>
<!-- Rem : If used as embbeded Resources, use
Modified:
ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/bin/Debug/SqlMap_Oracle_ODP.config
URL:
http://svn.apache.org/viewcvs/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/bin/Debug/SqlMap_Oracle_ODP.config?rev=378979&r1=378978&r2=378979&view=diff
==============================================================================
---
ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/bin/Debug/SqlMap_Oracle_ODP.config
(original)
+++
ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/bin/Debug/SqlMap_Oracle_ODP.config
Sun Feb 19 15:23:18 2006
@@ -39,6 +39,7 @@
<sqlMap resource="../../Maps/Oracle/ODP/Enumeration.xml"/>
<sqlMap resource="../../Maps/Oracle/ODP/Other.xml"/>
<sqlMap resource="../../Maps/Oracle/ODP/Document.xml"/>
+ <sqlMap resource="../../Maps/Oracle/ODP/ParameterClass.xml"/>
<sqlMap resource="../../Maps/Oracle/ODP/ResultClass.xml"/>
<!-- Rem : If used as embbeded Resources, use
<sqlMap embedded="Account.xml, IBatisNet.Test"/>
Modified:
ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/bin/Debug/SqlMap_Oracle_OracleClient.config
URL:
http://svn.apache.org/viewcvs/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/bin/Debug/SqlMap_Oracle_OracleClient.config?rev=378979&r1=378978&r2=378979&view=diff
==============================================================================
---
ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/bin/Debug/SqlMap_Oracle_OracleClient.config
(original)
+++
ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/bin/Debug/SqlMap_Oracle_OracleClient.config
Sun Feb 19 15:23:18 2006
@@ -39,6 +39,7 @@
<sqlMap
resource="../../Maps/Oracle/OracleClient/Enumeration.xml"/>
<sqlMap resource="../../Maps/Oracle/OracleClient/Other.xml"/>
<sqlMap resource="../../Maps/Oracle/OracleClient/Document.xml"/>
+ <sqlMap
resource="../../Maps/Oracle/OracleClient/ParameterClass.xml"/>
<sqlMap
resource="../../Maps/Oracle/OracleClient/ResultClass.xml"/>
<!-- Rem : If used as embbeded Resources, use
<sqlMap embedded="Account.xml, IBatisNet.DataMapper.Test"/>
Modified:
ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/bin/Debug/SqlMap_PostgreSQL_Npgsql.config
URL:
http://svn.apache.org/viewcvs/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/bin/Debug/SqlMap_PostgreSQL_Npgsql.config?rev=378979&r1=378978&r2=378979&view=diff
==============================================================================
---
ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/bin/Debug/SqlMap_PostgreSQL_Npgsql.config
(original)
+++
ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/bin/Debug/SqlMap_PostgreSQL_Npgsql.config
Sun Feb 19 15:23:18 2006
@@ -41,6 +41,7 @@
<sqlMap resource="../../Maps/PostgreSQL/Npgsql/LineItem.xml"/>
<sqlMap
resource="../../Maps/PostgreSQL/Npgsql/Enumeration.xml"/>
<sqlMap resource="../../Maps/PostgreSQL/Npgsql/Other.xml"/>
+ <sqlMap
resource="../../Maps/PostgreSQL/Npgsql/ParameterClass.xml"/>
<sqlMap
resource="../../Maps/PostgreSQL/Npgsql/ResultClass.xml"/>
<sqlMap resource="../../Maps/PostgreSQL/Npgsql/Document.xml"/>
<!-- Rem : If used as embbeded Resources, use
Modified:
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/IBatisNet.DataMapper.csproj
URL:
http://svn.apache.org/viewcvs/ibatis/trunk/cs/mapper/IBatisNet.DataMapper/IBatisNet.DataMapper.csproj?rev=378979&r1=378978&r2=378979&view=diff
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.DataMapper/IBatisNet.DataMapper.csproj
(original)
+++ ibatis/trunk/cs/mapper/IBatisNet.DataMapper/IBatisNet.DataMapper.csproj Sun
Feb 19 15:23:18 2006
@@ -848,6 +848,11 @@
BuildAction = "Compile"
/>
<File
+ RelPath = "TypeHandlers\DBNullTypeHandler.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
RelPath = "TypeHandlers\DecimalTypeHandler.cs"
SubType = "Code"
BuildAction = "Compile"
Added:
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/DBNullTypeHandler.cs
URL:
http://svn.apache.org/viewcvs/ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/DBNullTypeHandler.cs?rev=378979&view=auto
==============================================================================
---
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/DBNullTypeHandler.cs
(added)
+++
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/DBNullTypeHandler.cs
Sun Feb 19 15:23:18 2006
@@ -0,0 +1,76 @@
+
+#region Apache Notice
+/*****************************************************************************
+ * $Header: $
+ * $Revision: 378715 $
+ * $Date: 2006-02-18 06:41:00 -0500 (Sat, 18 Feb 2006) $
+ *
+ * iBATIS.NET Data Mapper
+ * Copyright (C) 2004 - Gilles Bayon
+ *
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+
********************************************************************************/
+#endregion
+
+#region Using
+
+using System;
+using System.Data;
+
+using IBatisNet.DataMapper.Configuration.ResultMapping;
+
+#endregion
+
+namespace IBatisNet.DataMapper.TypeHandlers
+{
+ /// <summary>
+ /// DBNull TypeHandler.
+ /// </summary>
+ internal class DBNullTypeHandler : BaseTypeHandler
+ {
+ public override object GetValueByName(ResultProperty mapping,
IDataReader dataReader)
+ {
+ return DBNull.Value;
+ }
+
+ public override object GetValueByIndex(ResultProperty mapping,
IDataReader dataReader)
+ {
+ return DBNull.Value;
+ }
+
+ public override object GetDataBaseValue(object outputValue,
Type parameterType )
+ {
+ return DBNull.Value;
+ }
+
+ public override bool IsSimpleType
+ {
+ get
+ {
+ return false;
+ }
+ }
+
+ public override object ValueOf(Type type, string s)
+ {
+ return DBNull.Value;
+ }
+
+ public override void SetParameter(IDataParameter dataParameter,
object parameterValue, string dbType)
+ {
+ dataParameter.Value = DBNull.Value;
+ }
+ }
+}
\ No newline at end of file
Modified:
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/TypeHandlerFactory.cs
URL:
http://svn.apache.org/viewcvs/ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/TypeHandlerFactory.cs?rev=378979&r1=378978&r2=378979&view=diff
==============================================================================
---
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/TypeHandlerFactory.cs
(original)
+++
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/TypeHandlerFactory.cs
Sun Feb 19 15:23:18 2006
@@ -2,7 +2,7 @@
#region Apache Notice
/*****************************************************************************
* $Header: $
- * $Revision: $
+ * $Revision$
* $Date$
*
* iBATIS.NET Data Mapper
@@ -64,6 +64,9 @@
{
ITypeHandler handler = null;
+ handler = new DBNullTypeHandler();
+ this.Register(typeof(DBNull), handler);
+
handler = new BooleanTypeHandler();
this.Register(typeof(bool), handler); // key=
"System.Boolean"
@@ -175,6 +178,7 @@
}
}
+
return handler;
}