1
|
|
|
2
|
|
#region Apache Notice
|
3
|
|
|
4
|
|
|
5
|
|
|
6
|
|
|
7
|
|
|
8
|
|
|
9
|
|
|
10
|
|
|
11
|
|
|
12
|
|
|
13
|
|
|
14
|
|
|
15
|
|
|
16
|
|
|
17
|
|
|
18
|
|
|
19
|
|
|
20
|
|
|
21
|
|
|
22
|
|
|
23
|
|
|
24
|
|
|
25
|
|
#endregion
|
26
|
|
|
27
|
|
#region Imports
|
28
|
|
using System;
|
29
|
|
using System.Collections;
|
30
|
|
using System.Text;
|
31
|
|
using System.IO;
|
32
|
|
|
33
|
|
using IBatisNet.DataMapper.Configuration.Sql.Dynamic.Elements;
|
34
|
|
using IBatisNet.DataMapper.Configuration.ParameterMapping;
|
35
|
|
#endregion
|
36
|
|
|
37
|
|
|
38
|
|
namespace IBatisNet.DataMapper.Configuration.Sql.Dynamic.Handlers
|
39
|
|
{
|
40
|
|
|
41
|
|
|
42
|
|
|
43
|
|
public class SqlTagContext
|
44
|
|
{
|
45
|
|
#region Fields
|
46
|
|
private Hashtable _attributes = new Hashtable();
|
47
|
|
private bool _overridePrepend = false;
|
48
|
|
private SqlTag _firstNonDynamicTagWithPrepend = null;
|
49
|
|
private ArrayList _parameterMappings = new ArrayList();
|
50
|
|
private StringBuilder buffer = new StringBuilder();
|
51
|
|
#endregion
|
52
|
|
|
53
|
|
|
54
|
|
|
55
|
|
|
56
|
|
|
57
|
49
|
public SqlTagContext()
|
58
|
|
{
|
59
|
49
|
_overridePrepend = false;
|
60
|
|
}
|
61
|
|
|
62
|
|
|
63
|
|
|
64
|
|
|
65
|
|
|
66
|
49
|
public StringBuilder GetWriter()
|
67
|
|
{
|
68
|
49
|
return buffer;
|
69
|
|
}
|
70
|
|
|
71
|
|
|
72
|
|
|
73
|
|
|
74
|
|
public string BodyText
|
75
|
|
{
|
76
|
49
|
get
|
77
|
|
{
|
78
|
49
|
return buffer.ToString().Trim();
|
79
|
|
}
|
80
|
|
}
|
81
|
|
|
82
|
|
|
83
|
|
|
84
|
|
|
85
|
|
public bool IsOverridePrepend
|
86
|
|
{
|
87
|
66
|
set
|
88
|
|
{
|
89
|
66
|
_overridePrepend = value;
|
90
|
|
}
|
91
|
164
|
get
|
92
|
|
{
|
93
|
164
|
return _overridePrepend;
|
94
|
|
}
|
95
|
|
}
|
96
|
|
|
97
|
|
|
98
|
|
|
99
|
|
|
100
|
|
public SqlTag FirstNonDynamicTagWithPrepend
|
101
|
|
{
|
102
|
151
|
get
|
103
|
|
{
|
104
|
151
|
return _firstNonDynamicTagWithPrepend;
|
105
|
|
}
|
106
|
47
|
set
|
107
|
|
{
|
108
|
47
|
_firstNonDynamicTagWithPrepend = value;
|
109
|
|
}
|
110
|
|
}
|
111
|
|
|
112
|
|
|
113
|
|
|
114
|
|
|
115
|
|
|
116
|
|
|
117
|
|
|
118
|
8
|
public void AddAttribute(object key, object value)
|
119
|
|
{
|
120
|
8
|
_attributes.Add(key, value);
|
121
|
|
}
|
122
|
|
|
123
|
|
|
124
|
|
|
125
|
|
|
126
|
|
|
127
|
|
|
128
|
80
|
public object GetAttribute(object key)
|
129
|
|
{
|
130
|
80
|
return _attributes[key];
|
131
|
|
}
|
132
|
|
|
133
|
|
|
134
|
|
|
135
|
|
|
136
|
|
|
137
|
59
|
public void AddParameterMapping(ParameterProperty mapping)
|
138
|
|
{
|
139
|
59
|
_parameterMappings.Add(mapping);
|
140
|
|
}
|
141
|
|
|
142
|
|
|
143
|
|
|
144
|
|
|
145
|
|
|
146
|
49
|
public IList GetParameterMappings()
|
147
|
|
{
|
148
|
49
|
return _parameterMappings;
|
149
|
|
}
|
150
|
|
}
|
151
|
|
}
|
152
|
|
|