1
|
|
#region Copyright
|
2
|
|
|
3
|
|
|
4
|
|
|
5
|
|
|
6
|
|
|
7
|
|
|
8
|
|
|
9
|
|
|
10
|
|
|
11
|
|
|
12
|
|
|
13
|
|
|
14
|
|
|
15
|
|
|
16
|
|
|
17
|
|
#endregion
|
18
|
|
|
19
|
|
using System;
|
20
|
|
using System.Data;
|
21
|
|
using Seasar.Extension.ADO;
|
22
|
|
using Seasar.Extension.ADO.Impl;
|
23
|
|
|
24
|
|
namespace Seasar.Extension.DataSets.States
|
25
|
|
{
|
26
|
|
public abstract class AbstractRowState : RowState
|
27
|
|
{
|
28
|
5
|
protected AbstractRowState()
|
29
|
|
{
|
30
|
|
}
|
31
|
|
|
32
|
|
#region RowState メンバ
|
33
|
|
|
34
|
5
|
public void Update(IDataSource dataSource, DataRow row)
|
35
|
|
{
|
36
|
5
|
DataTable table = row.Table;
|
37
|
5
|
string sql = GetSql(table);
|
38
|
5
|
string[] argNames = GetArgNames(table);
|
39
|
5
|
object[] args = GetArgs(row);
|
40
|
5
|
IUpdateHandler handler = new BasicUpdateHandler(dataSource, sql);
|
41
|
5
|
Execute(handler, args, argNames);
|
42
|
|
}
|
43
|
|
|
44
|
|
#endregion
|
45
|
|
|
46
|
|
protected abstract string GetSql(DataTable table);
|
47
|
|
|
48
|
|
protected abstract string[] GetArgNames(DataTable table);
|
49
|
|
|
50
|
|
protected abstract object[] GetArgs(DataRow row);
|
51
|
|
|
52
|
5
|
protected void Execute(IUpdateHandler handler, object[] args, string[] argNames)
|
53
|
|
{
|
54
|
5
|
handler.Execute(args, Type.GetTypeArray(args), argNames);
|
55
|
|
}
|
56
|
|
}
|
57
|
|
}
|
58
|
|
|