Clover.NET coverage report - Coverage

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

File Stats: LOC: 125   Methods: 5
NCLOC: 61 Classes: 1
 
Source File Conditionals Statements Methods TOTAL
TypeHandlers\ResultGetterImpl.cs 25.0 % 41.7 % 40.0 % 38.1 %
coverage coverage
1  
2  
3   #region Apache Notice
4   /*****************************************************************************
5   * $Header: $
6   * $Revision: $
7   * $Date: $
8   *
9   * iBATIS.NET Data Mapper
10   * Copyright (C) 2004 - Gilles Bayon
11   *
12   *
13   * Licensed under the Apache License, Version 2.0 (the "License");
14   * you may not use this file except in compliance with the License.
15   * You may obtain a copy of the License at
16   *
17   * http://www.apache.org/licenses/LICENSE-2.0
18   *
19   * Unless required by applicable law or agreed to in writing, software
20   * distributed under the License is distributed on an "AS IS" BASIS,
21   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
22   * See the License for the specific language governing permissions and
23   * limitations under the License.
24   *
25   ********************************************************************************/
26   #endregion
27  
28   #region Using
29  
30   using System.Data;
31  
32   #endregion
33  
34   namespace IBatisNet.DataMapper.TypeHandlers
35   {
36   /// <summary>
37   /// Description résumée de ResultGetterImpl.
38   /// </summary>
39   public class ResultGetterImpl : IResultGetter
40   {
41  
42   #region Fields
43  
44   private int _columnIndex = int.MinValue;
45   private string _columnName = string.Empty;
46   private object _outputValue = null;
47  
48   private IDataReader _dataReader = null;
49   #endregion
50  
51   #region Constructors
52  
53   /// <summary>
54   /// Creates an instance for a IDataReader and column index
55   /// </summary>
56   /// <param name="dataReader">The dataReader</param>
57   /// <param name="columnIndex">the column index</param>
58 0 public ResultGetterImpl(IDataReader dataReader, int columnIndex)
59   {
60   _columnIndex = columnIndex;
61   _dataReader = dataReader;
62   }
63  
64   /// <summary>
65   /// Creates an instance for a IDataReader and column name
66   /// </summary>
67   /// <param name="dataReader">The dataReader</param>
68   /// <param name="columnName">the column name</param>
69 224 public ResultGetterImpl(IDataReader dataReader, string columnName)
70   {
71 224 _columnName= columnName;
72 224 _dataReader = dataReader;
73   }
74  
75   /// <summary>
76   /// Creates an instance for an output parameter
77   /// </summary>
78   /// <param name="outputValue">value of an output parameter (store procedure)</param>
79 0 public ResultGetterImpl(object outputValue)
80   {
81   _outputValue = outputValue;
82   }
83   #endregion
84  
85   #region IResultGetter members
86  
87   /// <summary>
88   /// Returns the underlying IDataReader
89   /// </summary>
90   /// <remarks>Null for an output parameter</remarks>
91 0 public IDataReader DataReader
92   {
93   get
94   {
95   return _dataReader;
96   }
97   }
98  
99   /// <summary>
100   /// Get the parameter value
101   /// </summary>
102   public object Value
103   {
104 434 get
105   {
106 434 if (_columnName.Length >0)
107   {
108 434 int index = _dataReader.GetOrdinal(_columnName);
109 434 return _dataReader.GetValue(index);
110   }
111 0 else if (_columnIndex>=0)
112   {
113   return _dataReader.GetValue(_columnIndex);
114   }
115   else
116   {
117   return _outputValue;
118   }
119   }
120   }
121   #endregion
122  
123   }
124   }
125