You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ibatis.apache.org by ro...@apache.org on 2005/05/08 21:11:32 UTC

svn commit: r169149 - in /incubator/ibatis/trunk/cs/mapper: ./ IBatisNet.DataMapper.Test/Domain/ IBatisNet.DataMapper.Test/Maps/MSSQL/Odbc/ IBatisNet.DataMapper.Test/Maps/MSSQL/OleDb/ IBatisNet.DataMapper.Test/Maps/MSSQL/SqlClient/ IBatisNet.DataMapper.Test/Maps/MySql/ByteFx/ IBatisNet.DataMapper.Test/Maps/MySql/MySql/ IBatisNet.DataMapper.Test/Maps/Oracle/ODP/ IBatisNet.DataMapper.Test/Maps/Oracle/OracleClient/ IBatisNet.DataMapper.Test/NUnit/SqlMapTests/

Author: roberto
Date: Sun May  8 12:11:31 2005
New Revision: 169149

URL: http://svn.apache.org/viewcvs?rev=169149&view=rev
Log:
~Updated C# DataMapper NUnit Oracle SqlMaps for new bit (one/zero Oracle smallint) custom type handler
~Updated C# DataMapper NUnit SqlMaps for typehandler typo

Added:
    incubator/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Domain/OneZeroBoolTypeHandlerCallback.cs
Modified:
    incubator/ibatis/trunk/cs/mapper/   (props changed)
    incubator/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/MSSQL/Odbc/Other.xml
    incubator/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/MSSQL/OleDb/Other.xml
    incubator/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/MSSQL/SqlClient/Other.xml
    incubator/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/MySql/ByteFx/Other.xml
    incubator/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/MySql/MySql/Other.xml
    incubator/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/Oracle/ODP/Other.xml
    incubator/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/Oracle/OracleClient/Other.xml
    incubator/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/NUnit/SqlMapTests/StatementTest.cs

Propchange: incubator/ibatis/trunk/cs/mapper/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Sun May  8 12:11:31 2005
@@ -2,3 +2,4 @@
 _ReSharper.Common
 _ReSharper.DataMapper
 *.resharperoptions
+_ReSharper.DataAccess

Added: incubator/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Domain/OneZeroBoolTypeHandlerCallback.cs
URL: http://svn.apache.org/viewcvs/incubator/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Domain/OneZeroBoolTypeHandlerCallback.cs?rev=169149&view=auto
==============================================================================
--- incubator/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Domain/OneZeroBoolTypeHandlerCallback.cs (added)
+++ incubator/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Domain/OneZeroBoolTypeHandlerCallback.cs Sun May  8 12:11:31 2005
@@ -0,0 +1,65 @@
+using System;
+
+using IBatisNet.DataMapper.TypesHandler;
+
+namespace IBatisNet.DataMapper.Test.Domain
+{
+	/// <summary>
+	/// OneZeroBoolTypeHandlerCallback.
+	/// </summary>
+	public class OneZeroBoolTypeHandlerCallback : ITypeHandlerCallback
+	{
+		private const int TRUE = 1;
+		private const int FALSE = 0;
+
+		#region ITypeHandlerCallback members
+
+		public object GetNullValue(string nullValue)
+		{
+			if (TRUE.ToString().Equals(nullValue)) 
+			{
+				return true;
+			} 
+			else if (FALSE.ToString().Equals(nullValue)) 
+			{
+				return false;
+			} 
+			else 
+			{
+				throw new Exception("Unexpected value " + nullValue + " found where "+TRUE+" or "+FALSE+" was expected.");
+			}		
+		}
+
+		public object GetResult(IResultGetter getter)
+		{
+			int i = int.Parse(getter.Value.ToString());
+			if (TRUE.Equals(i)) 
+			{
+				return true;
+			}
+			else if (FALSE.Equals(i)) 
+			{
+				return false;
+			} 
+			else 
+			{
+ 				 throw new Exception("Unexpected value " + i + " found where "+TRUE+" or "+FALSE+" was expected.");
+			}
+		}
+
+		public void SetParameter(IParameterSetter setter, object parameter)
+		{
+			bool b = Convert.ToBoolean(parameter);
+			if (b) 
+			{
+				setter.Value = TRUE;
+			} 
+			else 
+			{
+				setter.Value = FALSE;
+			}			
+		}
+
+		#endregion
+	}
+}

Modified: incubator/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/MSSQL/Odbc/Other.xml
URL: http://svn.apache.org/viewcvs/incubator/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/MSSQL/Odbc/Other.xml?rev=169149&r1=169148&r2=169149&view=diff
==============================================================================
--- incubator/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/MSSQL/Odbc/Other.xml (original)
+++ incubator/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/MSSQL/Odbc/Other.xml Sun May  8 12:11:31 2005
@@ -58,7 +58,7 @@
 			( #Int#, #Long#, #Bool#, 'Yes')
 		</statement>			
 		
-		<statement id="InsertCustomTypeHnadler" 
+		<statement id="InsertCustomTypeHandler" 
 			parameterMap="insert-params">
 			Insert into Others
 				( Other_Int, Other_Long, Other_Bit, Other_String  )

Modified: incubator/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/MSSQL/OleDb/Other.xml
URL: http://svn.apache.org/viewcvs/incubator/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/MSSQL/OleDb/Other.xml?rev=169149&r1=169148&r2=169149&view=diff
==============================================================================
--- incubator/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/MSSQL/OleDb/Other.xml (original)
+++ incubator/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/MSSQL/OleDb/Other.xml Sun May  8 12:11:31 2005
@@ -58,7 +58,7 @@
 			( #Int#, #Long#, #Bool#, 'Yes')
 		</statement>			
 		
-		<statement id="InsertCustomTypeHnadler" 
+		<statement id="InsertCustomTypeHandler" 
 			parameterMap="insert-params">
 			Insert into Others
 				( Other_Int, Other_Long, Other_Bit, Other_String  )

Modified: incubator/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/MSSQL/SqlClient/Other.xml
URL: http://svn.apache.org/viewcvs/incubator/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/MSSQL/SqlClient/Other.xml?rev=169149&r1=169148&r2=169149&view=diff
==============================================================================
--- incubator/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/MSSQL/SqlClient/Other.xml (original)
+++ incubator/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/MSSQL/SqlClient/Other.xml Sun May  8 12:11:31 2005
@@ -58,7 +58,7 @@
 			( #Int#, #Long#, #Bool#, 'Yes')
 		</statement>
 		
-		<statement id="InsertCustomTypeHnadler" 
+		<statement id="InsertCustomTypeHandler" 
 			parameterMap="insert-params">
 			Insert into Others
 				( Other_Int, Other_Long, Other_Bit, Other_String  )

Modified: incubator/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/MySql/ByteFx/Other.xml
URL: http://svn.apache.org/viewcvs/incubator/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/MySql/ByteFx/Other.xml?rev=169149&r1=169148&r2=169149&view=diff
==============================================================================
--- incubator/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/MySql/ByteFx/Other.xml (original)
+++ incubator/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/MySql/ByteFx/Other.xml Sun May  8 12:11:31 2005
@@ -58,7 +58,7 @@
 			( #Int#, #Long#, #Bool#, 'Yes')
 		</statement>		
 					
-		<statement id="InsertCustomTypeHnadler" 
+		<statement id="InsertCustomTypeHandler" 
 			parameterMap="insert-params">
 			Insert into Others
 				( Other_Int, Other_Long, Other_Bit, Other_String  )

Modified: incubator/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/MySql/MySql/Other.xml
URL: http://svn.apache.org/viewcvs/incubator/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/MySql/MySql/Other.xml?rev=169149&r1=169148&r2=169149&view=diff
==============================================================================
--- incubator/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/MySql/MySql/Other.xml (original)
+++ incubator/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/MySql/MySql/Other.xml Sun May  8 12:11:31 2005
@@ -58,7 +58,7 @@
 			( #Int#, #Long#, #Bool#, 'Yes')
 		</statement>		
 					
-		<statement id="InsertCustomTypeHnadler" 
+		<statement id="InsertCustomTypeHandler" 
 			parameterMap="insert-params">
 			Insert into Others
 				( Other_Int, Other_Long, Other_Bit, Other_String  )

Modified: incubator/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/Oracle/ODP/Other.xml
URL: http://svn.apache.org/viewcvs/incubator/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/Oracle/ODP/Other.xml?rev=169149&r1=169148&r2=169149&view=diff
==============================================================================
--- incubator/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/Oracle/ODP/Other.xml (original)
+++ incubator/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/Oracle/ODP/Other.xml Sun May  8 12:11:31 2005
@@ -5,13 +5,14 @@
 	<alias>
 		<typeAlias alias="Other" type="IBatisNet.DataMapper.Test.Domain.Other, IBatisNet.DataMapper.Test"/>
 		<typeAlias alias="OuiNonBool" type="IBatisNet.DataMapper.Test.Domain.YesNoBoolTypeHandlerCallback, IBatisNet.DataMapper.Test"/>
+		<typeAlias alias="OneZeroBool" type="IBatisNet.DataMapper.Test.Domain.OneZeroBoolTypeHandlerCallback, IBatisNet.DataMapper.Test"/>
 	</alias>
 	
 	<resultMaps>                                    
 		<resultMap id="other-result"  class="Other" >
 			<result property="Int"		column="Other_Int" dbType="Int32"/>
 			<result property="Long"		column="Other_Long" dbType="Int64"/>
-			<result property="Bool"		column="Other_Bit"/>
+			<result property="Bool"		column="Other_Bit" typeHandler="OneZeroBool"/>
 			<result property="Bool2"	column="Other_String" typeHandler="OuiNonBool"/>
 		</resultMap>
 	</resultMaps>
@@ -98,7 +99,7 @@
 			( #Int#, #Long#, #Bool#, 'Yes')
 		</statement>	
 		
-		<statement id="InsertCustomTypeHnadler" 
+		<statement id="InsertCustomTypeHandler" 
 			parameterMap="insert-params">
 			Insert into Others
 				( Other_Int, Other_Long, Other_Bit, Other_String  )
@@ -124,7 +125,7 @@
 		<parameterMap id="insert-params">
 			<parameter property="Int" />
 			<parameter property="Long" />
-			<parameter property="Bool" />			
+			<parameter property="Bool" typeHandler="OneZeroBool"/>			
 			<parameter property="Bool2" typeHandler="OuiNonBool"/>
 		</parameterMap>
 	</parameterMaps>

Modified: incubator/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/Oracle/OracleClient/Other.xml
URL: http://svn.apache.org/viewcvs/incubator/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/Oracle/OracleClient/Other.xml?rev=169149&r1=169148&r2=169149&view=diff
==============================================================================
--- incubator/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/Oracle/OracleClient/Other.xml (original)
+++ incubator/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/Oracle/OracleClient/Other.xml Sun May  8 12:11:31 2005
@@ -5,13 +5,14 @@
 	<alias>
 		<typeAlias alias="Other" type="IBatisNet.DataMapper.Test.Domain.Other, IBatisNet.DataMapper.Test"/>
 		<typeAlias alias="OuiNonBool" type="IBatisNet.DataMapper.Test.Domain.YesNoBoolTypeHandlerCallback, IBatisNet.DataMapper.Test"/>
+		<typeAlias alias="OneZeroBool" type="IBatisNet.DataMapper.Test.Domain.OneZeroBoolTypeHandlerCallback, IBatisNet.DataMapper.Test"/>
 	</alias>
 	
 	<resultMaps>                                    
 		<resultMap id="other-result"  class="Other" >
 			<result property="Int"		column="Other_Int" dbType="Int32"/>
 			<result property="Long"		column="Other_Long" dbType="Int64"/>
-			<result property="Bool"		column="Other_Bit"/>
+			<result property="Bool"		column="Other_Bit" typeHandler="OneZeroBool"/>
 			<result property="Bool2"	column="Other_String" typeHandler="OuiNonBool"/>
 		</resultMap>
 	</resultMaps>
@@ -88,7 +89,7 @@
 			( #Int#, #Long#, #Bool#, 'Yes')
 		</statement>		
 				
-		<statement id="InsertCustomTypeHnadler" 
+		<statement id="InsertCustomTypeHandler" 
 			parameterMap="insert-params">
 			Insert into Others
 				( Other_Int, Other_Long, Other_Bit, Other_String  )
@@ -114,7 +115,7 @@
 		<parameterMap id="insert-params">
 			<parameter property="Int" />
 			<parameter property="Long" />
-			<parameter property="Bool" />			
+			<parameter property="Bool" typeHandler="OneZeroBool"/>			
 			<parameter property="Bool2" typeHandler="OuiNonBool"/>
 		</parameterMap>
 	</parameterMaps>	

Modified: incubator/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/NUnit/SqlMapTests/StatementTest.cs
URL: http://svn.apache.org/viewcvs/incubator/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/NUnit/SqlMapTests/StatementTest.cs?rev=169149&r1=169148&r2=169149&view=diff
==============================================================================
--- incubator/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/NUnit/SqlMapTests/StatementTest.cs (original)
+++ incubator/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/NUnit/SqlMapTests/StatementTest.cs Sun May  8 12:11:31 2005
@@ -1091,7 +1091,7 @@
 			other.Bool = true;
 			other.Bool2 = false;
 
-			sqlMap.Insert("InsertCustomTypeHnadler", other);
+			sqlMap.Insert("InsertCustomTypeHandler", other);
 
 			Other anOther = sqlMap.QueryForObject("SelectByInt", 99) as Other;