Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
SqlStringStorage.cs
Go to the documentation of this file.
4using System.IO;
5using System.Xml;
7
8namespace System.Data.Common;
9
10internal sealed class SqlStringStorage : DataStorage
11{
12 private SqlString[] _values;
13
18
19 public override object Aggregate(int[] recordNos, AggregateType kind)
20 {
21 try
22 {
23 switch (kind)
24 {
25 case AggregateType.Min:
26 {
27 int num3 = -1;
28 int i;
29 for (i = 0; i < recordNos.Length; i++)
30 {
31 if (!IsNull(recordNos[i]))
32 {
33 num3 = recordNos[i];
34 break;
35 }
36 }
37 if (num3 >= 0)
38 {
39 for (i++; i < recordNos.Length; i++)
40 {
41 if (!IsNull(recordNos[i]) && Compare(num3, recordNos[i]) > 0)
42 {
43 num3 = recordNos[i];
44 }
45 }
46 return Get(num3);
47 }
48 return _nullValue;
49 }
50 case AggregateType.Max:
51 {
52 int num2 = -1;
53 int i;
54 for (i = 0; i < recordNos.Length; i++)
55 {
56 if (!IsNull(recordNos[i]))
57 {
58 num2 = recordNos[i];
59 break;
60 }
61 }
62 if (num2 >= 0)
63 {
64 for (i++; i < recordNos.Length; i++)
65 {
66 if (Compare(num2, recordNos[i]) < 0)
67 {
68 num2 = recordNos[i];
69 }
70 }
71 return Get(num2);
72 }
73 return _nullValue;
74 }
75 case AggregateType.Count:
76 {
77 int num = 0;
78 for (int i = 0; i < recordNos.Length; i++)
79 {
80 if (!IsNull(recordNos[i]))
81 {
82 num++;
83 }
84 }
85 return num;
86 }
87 case AggregateType.First:
88 break;
89 }
90 }
91 catch (OverflowException)
92 {
94 }
96 }
97
98 public override int Compare(int recordNo1, int recordNo2)
99 {
101 }
102
104 {
105 if (valueNo1.IsNull && valueNo2.IsNull)
106 {
107 return 0;
108 }
109 if (valueNo1.IsNull)
110 {
111 return -1;
112 }
113 if (valueNo2.IsNull)
114 {
115 return 1;
116 }
117 return _table.Compare(valueNo1.Value, valueNo2.Value);
118 }
119
120 public override int CompareValueTo(int recordNo, object value)
121 {
123 }
124
125 public override object ConvertValue(object value)
126 {
127 if (value != null)
128 {
130 }
131 return _nullValue;
132 }
133
134 public override void Copy(int recordNo1, int recordNo2)
135 {
137 }
138
139 public override object Get(int record)
140 {
141 return _values[record];
142 }
143
144 public override int GetStringLength(int record)
145 {
147 if (!sqlString.IsNull)
148 {
149 return sqlString.Value.Length;
150 }
151 return 0;
152 }
153
154 public override bool IsNull(int record)
155 {
156 return _values[record].IsNull;
157 }
158
159 public override void Set(int record, object value)
160 {
162 }
163
164 public override void SetCapacity(int capacity)
165 {
167 if (_values != null)
168 {
170 }
171 _values = array;
172 }
173
174 [RequiresUnreferencedCode("Members from serialized types may be trimmed if not referenced directly.")]
175 public override object ConvertXmlToObject(string s)
176 {
177 SqlString sqlString = default(SqlString);
178 string s2 = "<col>" + s + "</col>";
181 using (XmlTextReader reader = new XmlTextReader(input))
182 {
183 xmlSerializable.ReadXml(reader);
184 }
185 return (SqlString)(object)xmlSerializable;
186 }
187
188 [RequiresUnreferencedCode("Members from serialized types may be trimmed if not referenced directly.")]
189 public override string ConvertObjectToXml(object value)
190 {
191 StringWriter stringWriter = new StringWriter(base.FormatProvider);
193 {
194 ((IXmlSerializable)value).WriteXml(writer);
195 }
196 return stringWriter.ToString();
197 }
198
199 protected override object GetEmptyStorage(int recordCount)
200 {
201 return new SqlString[recordCount];
202 }
203
204 protected override void CopyValue(int record, object store, BitArray nullbits, int storeIndex)
205 {
209 }
210
211 protected override void SetStorage(object store, BitArray nullbits)
212 {
214 }
215}
static unsafe void Copy(Array sourceArray, Array destinationArray, int length)
Definition Array.cs:624
readonly DataTable _table
static SqlString ConvertToSqlString(object value)
override string ConvertObjectToXml(object value)
override object Aggregate(int[] recordNos, AggregateType kind)
override object GetEmptyStorage(int recordCount)
override int Compare(int recordNo1, int recordNo2)
override int CompareValueTo(int recordNo, object value)
override object ConvertValue(object value)
override void CopyValue(int record, object store, BitArray nullbits, int storeIndex)
override void SetStorage(object store, BitArray nullbits)
override object Get(int record)
override int GetStringLength(int record)
override object ConvertXmlToObject(string s)
override void Set(int record, object value)
int Compare(SqlString valueNo1, SqlString valueNo2)
override void SetCapacity(int capacity)
override void Copy(int recordNo1, int recordNo2)
int Compare(string s1, string s2)
static Exception AggregateException(AggregateType aggregateType, Type type)
static Exception Overflow(Type type)
static byte Min(byte val1, byte val2)
Definition Math.cs:912