Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
NameNode.cs
Go to the documentation of this file.
4
5namespace System.Data;
6
7internal sealed class NameNode : ExpressionNode
8{
9 internal string _name;
10
11 internal bool _found;
12
14
15 internal override bool IsSqlColumn => _column.IsSqlType;
16
17 internal NameNode(DataTable table, char[] text, int start, int pos)
18 : base(table)
19 {
20 _name = ParseName(text, start, pos);
21 }
22
23 internal NameNode(DataTable table, string name)
24 : base(table)
25 {
26 _name = name;
27 }
28
29 internal override void Bind(DataTable table, List<DataColumn> list)
30 {
32 if (table == null)
33 {
35 }
36 try
37 {
39 }
40 catch (Exception e)
41 {
42 _found = false;
44 {
45 throw;
46 }
48 }
49 if (_column == null)
50 {
52 }
54 _found = true;
55 int i;
56 for (i = 0; i < list.Count; i++)
57 {
59 if (_column == dataColumn)
60 {
61 break;
62 }
63 }
64 if (i >= list.Count)
65 {
67 }
68 }
69
70 [RequiresUnreferencedCode("Members from serialized types may be trimmed if not referenced directly.")]
71 internal override object Eval()
72 {
74 }
75
76 [RequiresUnreferencedCode("Members from serialized types may be trimmed if not referenced directly.")]
77 internal override object Eval(DataRow row, DataRowVersion version)
78 {
79 if (!_found)
80 {
82 }
83 if (row == null)
84 {
85 if (IsTableConstant())
86 {
88 }
90 }
91 return _column[row.GetRecordFromVersion(version)];
92 }
93
94 [RequiresUnreferencedCode("Members from serialized types may be trimmed if not referenced directly.")]
95 internal override object Eval(int[] records)
96 {
98 }
99
100 internal override bool IsConstant()
101 {
102 return false;
103 }
104
105 internal override bool IsTableConstant()
106 {
107 if (_column != null && _column.Computed)
108 {
110 }
111 return false;
112 }
113
114 internal override bool HasLocalAggregate()
115 {
116 if (_column != null && _column.Computed)
117 {
119 }
120 return false;
121 }
122
123 internal override bool HasRemoteAggregate()
124 {
125 if (_column != null && _column.Computed)
126 {
128 }
129 return false;
130 }
131
132 internal override bool DependsOn(DataColumn column)
133 {
134 if (_column == column)
135 {
136 return true;
137 }
138 if (_column.Computed)
139 {
141 }
142 return false;
143 }
144
145 internal override ExpressionNode Optimize()
146 {
147 return this;
148 }
149
150 internal static string ParseName(char[] text, int start, int pos)
151 {
152 char c = '\0';
153 string text2 = string.Empty;
154 int num = start;
155 int num2 = pos;
156 checked
157 {
158 if (text[start] == '`')
159 {
160 start++;
161 pos--;
162 c = '\\';
163 text2 = "`";
164 }
165 else if (text[start] == '[')
166 {
167 start++;
168 pos--;
169 c = '\\';
170 text2 = "]\\";
171 }
172 }
173 if (c != 0)
174 {
175 int num3 = start;
176 for (int i = start; i < pos; i++)
177 {
178 if (text[i] == c && i + 1 < pos && text2.Contains(text[i + 1]))
179 {
180 i++;
181 }
182 text[num3] = text[i];
183 num3++;
184 }
185 pos = num3;
186 }
187 if (pos == start)
188 {
189 throw ExprException.InvalidName(new string(text, num, num2 - num));
190 }
191 return new string(text, start, pos - start);
192 }
193}
bool ICollection< KeyValuePair< TKey, TValue > >. Contains(KeyValuePair< TKey, TValue > keyValuePair)
void Add(TKey key, TValue value)
static bool IsCatchableExceptionType(Exception e)
Definition ADP.cs:790
DataExpression? DataExpression
bool DependsOn(DataColumn column)
DataColumnCollection Columns
Definition DataTable.cs:327
static Exception InvalidName(string name)
static Exception UnboundName(string name)
static Exception ComputeNotAggregate(string expr)
static Exception EvalNoContext()
void BindTable(DataTable table)
override bool HasRemoteAggregate()
Definition NameNode.cs:123
override object Eval()
Definition NameNode.cs:71
NameNode(DataTable table, string name)
Definition NameNode.cs:23
override bool DependsOn(DataColumn column)
Definition NameNode.cs:132
override object Eval(int[] records)
Definition NameNode.cs:95
static string ParseName(char[] text, int start, int pos)
Definition NameNode.cs:150
NameNode(DataTable table, char[] text, int start, int pos)
Definition NameNode.cs:17
override bool IsSqlColumn
Definition NameNode.cs:15
DataColumn _column
Definition NameNode.cs:13
override bool HasLocalAggregate()
Definition NameNode.cs:114
override bool IsConstant()
Definition NameNode.cs:100
override object Eval(DataRow row, DataRowVersion version)
Definition NameNode.cs:77
override void Bind(DataTable table, List< DataColumn > list)
Definition NameNode.cs:29
override ExpressionNode Optimize()
Definition NameNode.cs:145
override bool IsTableConstant()
Definition NameNode.cs:105