Clover.NET coverage report - Coverage

Coverage timestamp: Friday, May 20, 2005 9:17:00 PM

File Stats: LOC: 108   Methods: 2
NCLOC: 35 Classes: 1
 
Source File Conditionals Statements Methods TOTAL
TypeHandlers\BaseTypeHandler.cs 0.0 % 20.0 % 50.0 % 22.2 %
coverage coverage
1  
2   #region Apache Notice
3   /*****************************************************************************
4   * $Header: $
5   * $Revision: $
6   * $Date: $
7   *
8   * iBATIS.NET Data Mapper
9   * Copyright (C) 2004 - Gilles Bayon
10   *
11   *
12   * Licensed under the Apache License, Version 2.0 (the "License");
13   * you may not use this file except in compliance with the License.
14   * You may obtain a copy of the License at
15   *
16   * http://www.apache.org/licenses/LICENSE-2.0
17   *
18   * Unless required by applicable law or agreed to in writing, software
19   * distributed under the License is distributed on an "AS IS" BASIS,
20   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21   * See the License for the specific language governing permissions and
22   * limitations under the License.
23   *
24   ********************************************************************************/
25   #endregion
26  
27   #region Using
28  
29   using System;
30   using System.Data;
31   using IBatisNet.DataMapper.Configuration.ParameterMapping;
32   using IBatisNet.DataMapper.Configuration.ResultMapping;
33  
34   #endregion
35  
36   namespace IBatisNet.DataMapper.TypeHandlers
37   {
38   /// <summary>
39   /// Summary description for BaseTypeHandler.
40   /// </summary>
41   internal abstract class BaseTypeHandler : ITypeHandler
42   {
43   /// <summary>
44   /// Gets a column value by the name
45   /// </summary>
46   /// <param name="mapping"></param>
47   /// <param name="dataReader"></param>
48   /// <returns></returns>
49   public abstract object GetValueByName(ResultProperty mapping, IDataReader dataReader);
50  
51   /// <summary>
52   /// Gets a column value by the index
53   /// </summary>
54   /// <param name="mapping"></param>
55   /// <param name="dataReader"></param>
56   /// <returns></returns>
57   public abstract object GetValueByIndex(ResultProperty mapping, IDataReader dataReader);
58  
59   /// <summary>
60   /// Retrieve ouput database value of an output parameter
61   /// </summary>
62   /// <param name="outputValue">ouput database value</param>
63   /// <param name="parameterType">type used in EnumTypeHandler</param>
64   /// <returns></returns>
65   public abstract object GetDataBaseValue(object outputValue, Type parameterType );
66  
67   public abstract bool IsSimpleType{ get; }
68  
69   /// <summary>
70   /// Converts the String to the type that this handler deals with
71   /// </summary>
72   /// <param name="type">the tyepe of the property (used only for enum conversion)</param>
73   /// <param name="s">the String value</param>
74   /// <returns>the converted value</returns>
75   public abstract object ValueOf(Type type, string s);
76  
77   /// <summary>
78   /// Sets a parameter on a IDbCommand
79   /// </summary>
80   /// <param name="dataParameter">the parameter</param>
81   /// <param name="parameterValue">the parameter value</param>
82   /// <param name="dbType">the dbType of the parameter</param>
83 430 public virtual void SetParameter(IDataParameter dataParameter, object parameterValue, string dbType)
84   {
85 430 dataParameter.Value = parameterValue;
86   }
87  
88   /// <summary>
89   /// Compares two values (that this handler deals with) for equality
90   /// </summary>
91   /// <param name="obj">one of the objects</param>
92   /// <param name="str">the other object as a String</param>
93   /// <returns>true if they are equal</returns>
94 0 public virtual bool Equals(object obj, string str)
95   {
96   if (obj == null || str == null)
97   {
98   return obj == str;
99   }
100   else
101   {
102   object castedObject = ValueOf(obj.GetType(), str);
103   return obj.Equals(castedObject);
104   }
105   }
106   }
107   }
108