Clover.NET coverage report - Coverage for s2container.net

Coverage timestamp: 2006年5月30日 11:21:29

File Stats: LOC: 98   Methods: 8
NCLOC: 68 Classes: 1
 
Source File Conditionals Statements Methods TOTAL
Seasar.Extension.DataSets\Impl\SqlTableReader.cs 100.0% 84.2% 62.5% 79.3%
coverage coverage
1   #region Copyright
2   /*
3   * Copyright 2005 the Seasar Foundation and the Others.
4   *
5   * Licensed under the Apache License, Version 2.0 (the "License");
6   * you may not use this file except in compliance with the License.
7   * You may obtain a copy of the License at
8   *
9   * http://www.apache.org/licenses/LICENSE-2.0
10   *
11   * Unless required by applicable law or agreed to in writing, software
12   * distributed under the License is distributed on an "AS IS" BASIS,
13   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
14   * either express or implied. See the License for the specific language
15   * governing permissions and limitations under the License.
16   */
17   #endregion
18  
19   using System;
20   using System.Data;
21   using System.Text;
22   using Seasar.Extension.ADO;
23   using Seasar.Extension.ADO.Impl;
24   using Seasar.Extension.ADO.Types;
25  
26   namespace Seasar.Extension.DataSets.Impl
27   {
28   public class SqlTableReader : ITableReader
29   {
30   private IDataSource dataSource_;
31  
32   private string tableName_;
33  
34   private string sql_;
35  
36 10 public SqlTableReader(IDataSource dataSource)
37   {
38 10 dataSource_ = dataSource;
39   }
40  
41 0 public IDataSource DataSource
42   {
43   get { return dataSource_; }
44   }
45  
46 0 public string TableName
47   {
48   get { return tableName_; }
49   }
50  
51 0 public string Sql
52   {
53   get { return sql_; }
54   }
55  
56 1 public void SetTable(string tableName)
57   {
58 1 SetTable(tableName, null);
59   }
60  
61 7 public void SetTable(string tableName, String condition)
62   {
63 7 tableName_ = tableName;
64 7 StringBuilder sqlBuf = new StringBuilder(100);
65 7 sqlBuf.Append("SELECT * FROM ");
66 7 sqlBuf.Append(tableName);
67 7 if (condition != null)
68   {
69 6 sqlBuf.Append(" WHERE ");
70 6 sqlBuf.Append(condition);
71   }
72 7 sql_ = sqlBuf.ToString();
73   }
74  
75 3 public void SetSql(string sql, string tableName)
76   {
77 3 sql_ = sql;
78 3 tableName_ = tableName;
79   }
80  
81   #region ITableReader メンバ
82  
83 10 public DataTable Read()
84   {
85 10 ISelectHandler selectHandler = new BasicSelectHandler(
86   dataSource_,
87   sql_,
88   new DataTableDataReaderHandler(tableName_)
89   );
90 10 DataTable table = (DataTable) selectHandler.Execute(null);
91 10 table.AcceptChanges();
92 10 return table;
93   }
94  
95   #endregion
96   }
97   }
98