Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ Aggregate()

override object System.Data.Common.SqlStringStorage.Aggregate ( int[] recordNos,
AggregateType kind )
inlinevirtual

Reimplemented from System.Data.Common.DataStorage.

Definition at line 19 of file SqlStringStorage.cs.

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 {
93 throw ExprException.Overflow(typeof(SqlString));
94 }
95 throw ExceptionBuilder.AggregateException(kind, _dataType);
96 }
override int Compare(int recordNo1, int recordNo2)
override object Get(int record)

References System.Data.Common.DataStorage._dataType, System.Data.Common.DataStorage._nullValue, System.Data.ExceptionBuilder.AggregateException(), System.Data.Common.SqlStringStorage.Compare(), System.Xml.Dictionary, System.Data.Common.SqlStringStorage.Get(), System.Data.IsNull, and System.Data.ExprException.Overflow().