Clover.NET coverage report - Coverage for s2dao.net

Coverage timestamp: 2006年5月18日 15:09:15

File Stats: LOC: 99   Methods: 10
NCLOC: 72 Classes: 1
 
Source File Conditionals Statements Methods TOTAL
Seasar.Dao.Impl\AbstractDynamicCommand.cs 66.7% 83.3% 70.0% 76.1%
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 Seasar.Dao.Context;
21   using Seasar.Dao.Parser;
22   using Seasar.Extension.ADO;
23  
24   namespace Seasar.Dao.Impl
25   {
26   public abstract class AbstractDynamicCommand : AbstractSqlCommand
27   {
28   private INode rootNode;
29   private string[] argNames = new string[0];
30   private Type[] argTypes = new Type[0];
31  
32 50 public AbstractDynamicCommand(IDataSource dataSource, ICommandFactory commandFactory)
33   : base(dataSource, commandFactory)
34   {
35   }
36  
37   public override string Sql
38   {
39 50 set
40   {
41 50 base.Sql = value;
42 50 rootNode = new SqlParserImpl(value).Parse();
43   }
44 0 get
45   {
46   return base.Sql;
47   }
48   }
49  
50   public string[] ArgNames
51   {
52 0 get { return argNames; }
53 50 set { argNames = value; }
54   }
55  
56   public Type[] ArgTypes
57   {
58 0 get { return argTypes; }
59 49 set { argTypes = value; }
60   }
61  
62 11 protected ICommandContext Apply(object[] args)
63   {
64 11 ICommandContext ctx = CreateCommandContext(args);
65 11 rootNode.Accept(ctx);
66 11 return ctx;
67   }
68  
69 11 protected ICommandContext CreateCommandContext(object[] args)
70   {
71 11 ICommandContext ctx = GetCommandContext();
72 11 if(args != null)
73   {
74 21 for(int i = 0; i < args.Length; ++i)
75   {
76 10 Type argType = null;
77 10 if(args[i] != null)
78   {
79 10 if(i < argTypes.Length)
80 9 argType = argTypes[i];
81 1 else if (args[i] != null)
82 1 argType = args[i].GetType();
83   }
84 10 if(i < argNames.Length)
85 10 ctx.AddArg(argNames[i], args[i], argType);
86   else
87 0 ctx.AddArg("$" + (i + 1), args[i], argType);
88   }
89   }
90 11 return ctx;
91   }
92  
93 11 private ICommandContext GetCommandContext()
94   {
95 11 return new CommandContextImpl();
96   }
97   }
98   }
99