Terraria
v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
SqlCharsStorage.cs
Go to the documentation of this file.
1
using
System.Collections
;
2
using
System.Data.SqlTypes
;
3
using
System.Diagnostics.CodeAnalysis
;
4
using
System.IO
;
5
using
System.Xml
;
6
using
System.Xml.Serialization
;
7
8
namespace
System.Data.Common
;
9
10
internal
sealed
class
SqlCharsStorage
:
DataStorage
11
{
12
private
SqlChars
[]
_values
;
13
14
public
SqlCharsStorage
(
DataColumn
column
)
15
:
base
(
column
,
typeof
(
SqlChars
),
SqlChars
.
Null
,
SqlChars
.
Null
,
StorageType
.
SqlChars
)
16
{
17
}
18
19
public
override
object
Aggregate
(
int
[]
records
,
AggregateType
kind)
20
{
21
try
22
{
23
switch
(kind)
24
{
25
case
AggregateType
.First:
26
if
(
records
.Length != 0)
27
{
28
return
_values
[
records
[0]];
29
}
30
return
null
;
31
case
AggregateType
.Count:
32
{
33
int
num = 0;
34
for
(
int
i = 0; i <
records
.Length; i++)
35
{
36
if
(!
IsNull
(
records
[i]))
37
{
38
num++;
39
}
40
}
41
return
num;
42
}
43
}
44
}
45
catch
(
OverflowException
)
46
{
47
throw
ExprException
.
Overflow
(
typeof
(
SqlChars
));
48
}
49
throw
ExceptionBuilder
.
AggregateException
(kind,
_dataType
);
50
}
51
52
public
override
int
Compare
(
int
recordNo1
,
int
recordNo2
)
53
{
54
return
0;
55
}
56
57
public
override
int
CompareValueTo
(
int
recordNo
,
object
value
)
58
{
59
return
0;
60
}
61
62
public
override
void
Copy
(
int
recordNo1
,
int
recordNo2
)
63
{
64
_values
[
recordNo2
] =
_values
[
recordNo1
];
65
}
66
67
public
override
object
Get
(
int
record
)
68
{
69
return
_values
[
record
];
70
}
71
72
public
override
bool
IsNull
(
int
record
)
73
{
74
return
_values
[
record
].
IsNull
;
75
}
76
77
public
override
void
Set
(
int
record
,
object
value
)
78
{
79
if
(
value
==
DBNull
.
Value
||
value
==
null
)
80
{
81
_values
[
record
] =
SqlChars
.
Null
;
82
}
83
else
84
{
85
_values
[
record
] = (
SqlChars
)
value
;
86
}
87
}
88
89
public
override
void
SetCapacity
(
int
capacity
)
90
{
91
SqlChars
[]
array
=
new
SqlChars
[
capacity
];
92
if
(
_values
!=
null
)
93
{
94
Array
.
Copy
(
_values
,
array
,
Math
.
Min
(
capacity
,
_values
.
Length
));
95
}
96
_values
=
array
;
97
}
98
99
[
RequiresUnreferencedCode
(
"Members from serialized types may be trimmed if not referenced directly."
)]
100
public
override
object
ConvertXmlToObject
(
string
s
)
101
{
102
SqlString
sqlString
=
default
(
SqlString
);
103
string
s2
=
"<col>"
+
s
+
"</col>"
;
104
StringReader
input
=
new
StringReader
(
s2
);
105
IXmlSerializable
xmlSerializable
=
sqlString
;
106
using
(
XmlTextReader
reader =
new
XmlTextReader
(
input
))
107
{
108
xmlSerializable
.
ReadXml
(reader);
109
}
110
return
new
SqlChars
((
SqlString
)(
object
)
xmlSerializable
);
111
}
112
113
[
RequiresUnreferencedCode
(
"Members from serialized types may be trimmed if not referenced directly."
)]
114
public
override
string
ConvertObjectToXml
(
object
value
)
115
{
116
StringWriter
stringWriter
=
new
StringWriter
(
base
.FormatProvider);
117
using
(
XmlTextWriter
writer
=
new
XmlTextWriter
(
stringWriter
))
118
{
119
((
IXmlSerializable
)
value
).WriteXml(
writer
);
120
}
121
return
stringWriter
.ToString();
122
}
123
124
protected
override
object
GetEmptyStorage
(
int
recordCount
)
125
{
126
return
new
SqlChars
[
recordCount
];
127
}
128
129
protected
override
void
CopyValue
(
int
record
,
object
store
,
BitArray
nullbits
,
int
storeIndex
)
130
{
131
SqlChars
[]
array
= (
SqlChars
[])
store
;
132
array
[
storeIndex
] =
_values
[
record
];
133
nullbits
.Set(
storeIndex
,
IsNull
(
record
));
134
}
135
136
protected
override
void
SetStorage
(
object
store
,
BitArray
nullbits
)
137
{
138
_values
= (
SqlChars
[])
store
;
139
}
140
}
System.Array.Copy
static unsafe void Copy(Array sourceArray, Array destinationArray, int length)
Definition
Array.cs:624
System.Array
Definition
Array.cs:16
System.Collections.BitArray
Definition
BitArray.cs:12
System.DBNull.Value
static readonly DBNull Value
Definition
DBNull.cs:8
System.DBNull
Definition
DBNull.cs:7
System.Data.Common.DataStorage._dataType
readonly Type _dataType
Definition
DataStorage.cs:63
System.Data.Common.DataStorage
Definition
DataStorage.cs:13
System.Data.Common.SqlCharsStorage.CopyValue
override void CopyValue(int record, object store, BitArray nullbits, int storeIndex)
Definition
SqlCharsStorage.cs:129
System.Data.Common.SqlCharsStorage.SqlCharsStorage
SqlCharsStorage(DataColumn column)
Definition
SqlCharsStorage.cs:14
System.Data.Common.SqlCharsStorage.Set
override void Set(int record, object value)
Definition
SqlCharsStorage.cs:77
System.Data.Common.SqlCharsStorage.SetCapacity
override void SetCapacity(int capacity)
Definition
SqlCharsStorage.cs:89
System.Data.Common.SqlCharsStorage.GetEmptyStorage
override object GetEmptyStorage(int recordCount)
Definition
SqlCharsStorage.cs:124
System.Data.Common.SqlCharsStorage._values
SqlChars[] _values
Definition
SqlCharsStorage.cs:12
System.Data.Common.SqlCharsStorage.Copy
override void Copy(int recordNo1, int recordNo2)
Definition
SqlCharsStorage.cs:62
System.Data.Common.SqlCharsStorage.IsNull
override bool IsNull(int record)
Definition
SqlCharsStorage.cs:72
System.Data.Common.SqlCharsStorage.Compare
override int Compare(int recordNo1, int recordNo2)
Definition
SqlCharsStorage.cs:52
System.Data.Common.SqlCharsStorage.ConvertXmlToObject
override object ConvertXmlToObject(string s)
Definition
SqlCharsStorage.cs:100
System.Data.Common.SqlCharsStorage.Get
override object Get(int record)
Definition
SqlCharsStorage.cs:67
System.Data.Common.SqlCharsStorage.SetStorage
override void SetStorage(object store, BitArray nullbits)
Definition
SqlCharsStorage.cs:136
System.Data.Common.SqlCharsStorage.Aggregate
override object Aggregate(int[] records, AggregateType kind)
Definition
SqlCharsStorage.cs:19
System.Data.Common.SqlCharsStorage.ConvertObjectToXml
override string ConvertObjectToXml(object value)
Definition
SqlCharsStorage.cs:114
System.Data.Common.SqlCharsStorage.CompareValueTo
override int CompareValueTo(int recordNo, object value)
Definition
SqlCharsStorage.cs:57
System.Data.Common.SqlCharsStorage
Definition
SqlCharsStorage.cs:11
System.Data.DataColumn
Definition
DataColumn.cs:24
System.Data.ExceptionBuilder.AggregateException
static Exception AggregateException(AggregateType aggregateType, Type type)
Definition
ExceptionBuilder.cs:1211
System.Data.ExceptionBuilder
Definition
ExceptionBuilder.cs:8
System.Data.ExprException.Overflow
static Exception Overflow(Type type)
Definition
ExprException.cs:163
System.Data.ExprException
Definition
ExprException.cs:6
System.Data.SqlTypes.SqlChars.IsNull
bool IsNull
Definition
SqlChars.cs:22
System.Data.SqlTypes.SqlChars.Null
static SqlChars Null
Definition
SqlChars.cs:120
System.Data.SqlTypes.SqlChars.Length
long Length
Definition
SqlChars.cs:36
System.Data.SqlTypes.SqlChars
Definition
SqlChars.cs:11
System.IO.StringReader
Definition
StringReader.cs:7
System.IO.StringWriter
Definition
StringWriter.cs:9
System.Math.Min
static byte Min(byte val1, byte val2)
Definition
Math.cs:912
System.Math
Definition
Math.cs:13
System.OverflowException
Definition
OverflowException.cs:9
System.Xml.XmlTextReader
Definition
XmlTextReader.cs:10
System.Xml.XmlTextWriter
Definition
XmlTextWriter.cs:11
System.Xml.Serialization.IXmlSerializable.ReadXml
void ReadXml(XmlReader reader)
System.Xml.Serialization.IXmlSerializable
Definition
IXmlSerializable.cs:6
System.Collections
Definition
BlockingCollection.cs:8
System.Data.Common.StorageType
StorageType
Definition
StorageType.cs:4
System.Data.Common.StorageType.SqlChars
@ SqlChars
System.Data.Common
Definition
ADP.cs:12
System.Data.SqlTypes
Definition
EComparison.cs:1
System.Data.ValueType.Null
@ Null
System.Data.AggregateType
AggregateType
Definition
AggregateType.cs:4
System.Data.FunctionId.IsNull
@ IsNull
System.Diagnostics.CodeAnalysis
Definition
AllowNullAttribute.cs:1
System.IO
Definition
ConsoleStream.cs:3
System.Xml.Serialization
Definition
DateTimeSerializationSection.cs:1
System.Xml.ValueHandleType.Dictionary
@ Dictionary
System.Xml
Definition
BaseRegionIterator.cs:1
System.ExceptionArgument.s
@ s
System.ExceptionArgument.value
@ value
System.ExceptionArgument.capacity
@ capacity
System.ExceptionArgument.input
@ input
System.ExceptionArgument.writer
@ writer
System.ExceptionArgument.array
@ array
System.Data.SqlTypes.SqlString
Definition
SqlString.cs:16
source
System.Data.Common
System.Data.Common
SqlCharsStorage.cs
Generated by
1.10.0