Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
DbSchemaRow.cs
Go to the documentation of this file.
3
4namespace System.Data.Common;
5
6internal sealed class DbSchemaRow
7{
8 private readonly DbSchemaTable _schemaTable;
9
10 private readonly DataRow _dataRow;
11
13
14 internal string ColumnName
15 {
16 get
17 {
19 if (!Convert.IsDBNull(obj))
20 {
22 }
23 return string.Empty;
24 }
25 }
26
27 internal int Size
28 {
29 get
30 {
33 {
35 }
36 return 0;
37 }
38 }
39
40 internal string BaseColumnName
41 {
42 get
43 {
44 if (_schemaTable.BaseColumnName != null)
45 {
47 if (!Convert.IsDBNull(obj))
48 {
50 }
51 }
52 return string.Empty;
53 }
54 }
55
56 internal string BaseServerName
57 {
58 get
59 {
60 if (_schemaTable.BaseServerName != null)
61 {
63 if (!Convert.IsDBNull(obj))
64 {
66 }
67 }
68 return string.Empty;
69 }
70 }
71
72 internal string BaseCatalogName
73 {
74 get
75 {
76 if (_schemaTable.BaseCatalogName != null)
77 {
79 if (!Convert.IsDBNull(obj))
80 {
82 }
83 }
84 return string.Empty;
85 }
86 }
87
88 internal string BaseSchemaName
89 {
90 get
91 {
92 if (_schemaTable.BaseSchemaName != null)
93 {
95 if (!Convert.IsDBNull(obj))
96 {
98 }
99 }
100 return string.Empty;
101 }
102 }
103
104 internal string BaseTableName
105 {
106 get
107 {
108 if (_schemaTable.BaseTableName != null)
109 {
111 if (!Convert.IsDBNull(obj))
112 {
114 }
115 }
116 return string.Empty;
117 }
118 }
119
120 internal bool IsAutoIncrement
121 {
122 get
123 {
124 if (_schemaTable.IsAutoIncrement != null)
125 {
127 if (!Convert.IsDBNull(value))
128 {
130 }
131 }
132 return false;
133 }
134 }
135
136 internal bool IsUnique
137 {
138 get
139 {
140 if (_schemaTable.IsUnique != null)
141 {
143 if (!Convert.IsDBNull(value))
144 {
146 }
147 }
148 return false;
149 }
150 }
151
152 internal bool IsRowVersion
153 {
154 get
155 {
156 if (_schemaTable.IsRowVersion != null)
157 {
159 if (!Convert.IsDBNull(value))
160 {
162 }
163 }
164 return false;
165 }
166 }
167
168 internal bool IsKey
169 {
170 get
171 {
172 if (_schemaTable.IsKey != null)
173 {
175 if (!Convert.IsDBNull(value))
176 {
178 }
179 }
180 return false;
181 }
182 }
183
184 internal bool IsExpression
185 {
186 get
187 {
188 if (_schemaTable.IsExpression != null)
189 {
191 if (!Convert.IsDBNull(value))
192 {
194 }
195 }
196 return false;
197 }
198 }
199
200 internal bool IsHidden
201 {
202 get
203 {
204 if (_schemaTable.IsHidden != null)
205 {
207 if (!Convert.IsDBNull(value))
208 {
210 }
211 }
212 return false;
213 }
214 }
215
216 internal bool IsLong
217 {
218 get
219 {
220 if (_schemaTable.IsLong != null)
221 {
223 if (!Convert.IsDBNull(value))
224 {
226 }
227 }
228 return false;
229 }
230 }
231
232 internal bool IsReadOnly
233 {
234 get
235 {
236 if (_schemaTable.IsReadOnly != null)
237 {
239 if (!Convert.IsDBNull(value))
240 {
242 }
243 }
244 return false;
245 }
246 }
247
248 internal Type DataType
249 {
250 [RequiresUnreferencedCode("DataRow's DataType cannot be statically analyzed")]
251 get
252 {
253 if (_schemaTable.DataType != null)
254 {
256 if (!Convert.IsDBNull(obj))
257 {
258 return (Type)obj;
259 }
260 }
261 return null;
262 }
263 }
264
265 internal bool AllowDBNull
266 {
267 get
268 {
269 if (_schemaTable.AllowDBNull != null)
270 {
272 if (!Convert.IsDBNull(value))
273 {
275 }
276 }
277 return true;
278 }
279 }
280
282
283 internal static DbSchemaRow[] GetSortedSchemaRows(DataTable dataTable, bool returnProviderSpecificTypes)
284 {
285 DataColumn dataColumn = dataTable.Columns["SchemaMapping Unsorted Index"];
286 if (dataColumn == null)
287 {
288 dataColumn = new DataColumn("SchemaMapping Unsorted Index", typeof(int));
289 dataTable.Columns.Add(dataColumn);
290 }
291 int count = dataTable.Rows.Count;
292 for (int i = 0; i < count; i++)
293 {
294 dataTable.Rows[i][dataColumn] = i;
295 }
296 DbSchemaTable schemaTable = new DbSchemaTable(dataTable, returnProviderSpecificTypes);
297 DataRow[] array = SelectRows(dataTable, returnProviderSpecificTypes);
298 DbSchemaRow[] array2 = new DbSchemaRow[array.Length];
299 for (int j = 0; j < array.Length; j++)
300 {
301 array2[j] = new DbSchemaRow(schemaTable, array[j]);
302 }
303 return array2;
304 }
305
306 [UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:RequiresUnreferencedCode", Justification = "Filter expression is null.")]
307 private static DataRow[] SelectRows(DataTable dataTable, bool returnProviderSpecificTypes)
308 {
309 return dataTable.Select(null, "ColumnOrdinal ASC", DataViewRowState.CurrentRows);
310 }
311
312 internal DbSchemaRow(DbSchemaTable schemaTable, DataRow dataRow)
313 {
314 _schemaTable = schemaTable;
315 _dataRow = dataRow;
316 }
317}
static ? string ToString(object? value)
Definition Convert.cs:2321
static bool IsDBNull([NotNullWhen(true)] object? value)
Definition Convert.cs:215
static int ToInt32(object? value)
Definition Convert.cs:1320
static bool ToBoolean([NotNullWhen(true)] object? value)
Definition Convert.cs:508
static DbSchemaRow[] GetSortedSchemaRows(DataTable dataTable, bool returnProviderSpecificTypes)
DbSchemaRow(DbSchemaTable schemaTable, DataRow dataRow)
static DataRow[] SelectRows(DataTable dataTable, bool returnProviderSpecificTypes)
readonly DbSchemaTable _schemaTable
Definition DbSchemaRow.cs:8
DataRowCollection Rows
Definition DataTable.cs:701
DataColumnCollection Columns
Definition DataTable.cs:327
static CultureInfo InvariantCulture