Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
DbDataReader.cs
Go to the documentation of this file.
5using System.IO;
8
9namespace System.Data.Common;
10
12{
13 public abstract int Depth { get; }
14
15 public abstract int FieldCount { get; }
16
17 public abstract bool HasRows { get; }
18
19 public abstract bool IsClosed { get; }
20
21 public abstract int RecordsAffected { get; }
22
23 public virtual int VisibleFieldCount => FieldCount;
24
25 public abstract object this[int ordinal] { get; }
26
27 public abstract object this[string name] { get; }
28
29 public virtual void Close()
30 {
31 }
32
33 public virtual Task CloseAsync()
34 {
35 try
36 {
37 Close();
38 return Task.CompletedTask;
39 }
40 catch (Exception exception)
41 {
43 }
44 }
45
46 [EditorBrowsable(EditorBrowsableState.Never)]
47 public void Dispose()
48 {
49 Dispose(disposing: true);
50 }
51
52 protected virtual void Dispose(bool disposing)
53 {
54 if (disposing)
55 {
56 Close();
57 }
58 }
59
60 public virtual ValueTask DisposeAsync()
61 {
62 Dispose();
63 return default(ValueTask);
64 }
65
66 public abstract string GetDataTypeName(int ordinal);
67
68 [EditorBrowsable(EditorBrowsableState.Never)]
69 public abstract IEnumerator GetEnumerator();
70
71 [return: DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicFields | DynamicallyAccessedMemberTypes.PublicProperties)]
72 public abstract Type GetFieldType(int ordinal);
73
74 public abstract string GetName(int ordinal);
75
76 public abstract int GetOrdinal(string name);
77
78 public virtual DataTable? GetSchemaTable()
79 {
80 throw new NotSupportedException();
81 }
82
84 {
85 if (cancellationToken.IsCancellationRequested)
86 {
88 }
89 try
90 {
91 return Task.FromResult(GetSchemaTable());
92 }
93 catch (Exception exception)
94 {
96 }
97 }
98
100 {
101 if (cancellationToken.IsCancellationRequested)
102 {
104 }
105 try
106 {
107 return Task.FromResult(this.GetColumnSchema());
108 }
109 catch (Exception exception)
110 {
112 }
113 }
114
115 public abstract bool GetBoolean(int ordinal);
116
117 public abstract byte GetByte(int ordinal);
118
119 public abstract long GetBytes(int ordinal, long dataOffset, byte[]? buffer, int bufferOffset, int length);
120
121 public abstract char GetChar(int ordinal);
122
123 public abstract long GetChars(int ordinal, long dataOffset, char[]? buffer, int bufferOffset, int length);
124
125 [EditorBrowsable(EditorBrowsableState.Never)]
126 public DbDataReader GetData(int ordinal)
127 {
128 return GetDbDataReader(ordinal);
129 }
130
132 {
133 return GetDbDataReader(ordinal);
134 }
135
136 protected virtual DbDataReader GetDbDataReader(int ordinal)
137 {
138 throw ADP.NotSupported();
139 }
140
141 public abstract DateTime GetDateTime(int ordinal);
142
143 public abstract decimal GetDecimal(int ordinal);
144
145 public abstract double GetDouble(int ordinal);
146
147 public abstract float GetFloat(int ordinal);
148
149 public abstract Guid GetGuid(int ordinal);
150
151 public abstract short GetInt16(int ordinal);
152
153 public abstract int GetInt32(int ordinal);
154
155 public abstract long GetInt64(int ordinal);
156
157 [EditorBrowsable(EditorBrowsableState.Never)]
158 [return: DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicFields | DynamicallyAccessedMemberTypes.PublicProperties)]
159 public virtual Type GetProviderSpecificFieldType(int ordinal)
160 {
161 return GetFieldType(ordinal);
162 }
163
164 [EditorBrowsable(EditorBrowsableState.Never)]
165 public virtual object GetProviderSpecificValue(int ordinal)
166 {
167 return GetValue(ordinal);
168 }
169
170 [EditorBrowsable(EditorBrowsableState.Never)]
171 public virtual int GetProviderSpecificValues(object[] values)
172 {
173 return GetValues(values);
174 }
175
176 public abstract string GetString(int ordinal);
177
178 public virtual Stream GetStream(int ordinal)
179 {
180 using MemoryStream memoryStream = new MemoryStream();
181 long num = 0L;
182 long num2 = 0L;
183 byte[] array = new byte[4096];
184 do
185 {
186 num = GetBytes(ordinal, num2, array, 0, array.Length);
187 memoryStream.Write(array, 0, (int)num);
188 num2 += num;
189 }
190 while (num > 0);
191 return new MemoryStream(memoryStream.ToArray(), writable: false);
192 }
193
194 public virtual TextReader GetTextReader(int ordinal)
195 {
196 if (IsDBNull(ordinal))
197 {
198 return new StringReader(string.Empty);
199 }
200 return new StringReader(GetString(ordinal));
201 }
202
203 public abstract object GetValue(int ordinal);
204
205 public virtual T GetFieldValue<T>(int ordinal)
206 {
207 return (T)GetValue(ordinal);
208 }
209
210 public Task<T> GetFieldValueAsync<T>(int ordinal)
211 {
213 }
214
216 {
217 if (cancellationToken.IsCancellationRequested)
218 {
219 return ADP.CreatedTaskWithCancellation<T>();
220 }
221 try
222 {
223 return Task.FromResult(GetFieldValue<T>(ordinal));
224 }
225 catch (Exception exception)
226 {
227 return Task.FromException<T>(exception);
228 }
229 }
230
231 public abstract int GetValues(object[] values);
232
233 public abstract bool IsDBNull(int ordinal);
234
235 public Task<bool> IsDBNullAsync(int ordinal)
236 {
237 return IsDBNullAsync(ordinal, CancellationToken.None);
238 }
239
241 {
242 if (cancellationToken.IsCancellationRequested)
243 {
244 return ADP.CreatedTaskWithCancellation<bool>();
245 }
246 try
247 {
248 return IsDBNull(ordinal) ? ADP.TrueTask : ADP.FalseTask;
249 }
250 catch (Exception exception)
251 {
252 return Task.FromException<bool>(exception);
253 }
254 }
255
256 public abstract bool NextResult();
257
258 public abstract bool Read();
259
261 {
263 }
264
266 {
267 if (cancellationToken.IsCancellationRequested)
268 {
269 return ADP.CreatedTaskWithCancellation<bool>();
270 }
271 try
272 {
273 return Read() ? ADP.TrueTask : ADP.FalseTask;
274 }
275 catch (Exception exception)
276 {
277 return Task.FromException<bool>(exception);
278 }
279 }
280
285
287 {
288 if (cancellationToken.IsCancellationRequested)
289 {
290 return ADP.CreatedTaskWithCancellation<bool>();
291 }
292 try
293 {
294 return NextResult() ? ADP.TrueTask : ADP.FalseTask;
295 }
296 catch (Exception exception)
297 {
298 return Task.FromException<bool>(exception);
299 }
300 }
301}
static NotSupportedException NotSupported()
Definition ADP.cs:753
static Task< bool > FalseTask
Definition ADP.cs:67
string GetString(int ordinal)
double GetDouble(int ordinal)
long GetBytes(int ordinal, long dataOffset, byte[]? buffer, int bufferOffset, int length)
Type GetFieldType(int ordinal)
virtual Stream GetStream(int ordinal)
virtual int GetProviderSpecificValues(object[] values)
virtual object GetProviderSpecificValue(int ordinal)
bool GetBoolean(int ordinal)
int GetValues(object[] values)
string GetName(int ordinal)
virtual void Dispose(bool disposing)
virtual T GetFieldValue< T >(int ordinal)
float GetFloat(int ordinal)
Task< T > GetFieldValueAsync< T >(int ordinal)
virtual Task< bool > NextResultAsync(CancellationToken cancellationToken)
decimal GetDecimal(int ordinal)
long GetChars(int ordinal, long dataOffset, char[]? buffer, int bufferOffset, int length)
virtual Task< DataTable?> GetSchemaTableAsync(CancellationToken cancellationToken=default(CancellationToken))
string GetDataTypeName(int ordinal)
virtual Task< bool > IsDBNullAsync(int ordinal, CancellationToken cancellationToken)
virtual Type GetProviderSpecificFieldType(int ordinal)
object GetValue(int ordinal)
DateTime GetDateTime(int ordinal)
DbDataReader GetData(int ordinal)
virtual ValueTask DisposeAsync()
virtual Task< bool > ReadAsync(CancellationToken cancellationToken)
Task< bool > IsDBNullAsync(int ordinal)
virtual Task< ReadOnlyCollection< DbColumn > > GetColumnSchemaAsync(CancellationToken cancellationToken=default(CancellationToken))
virtual DbDataReader GetDbDataReader(int ordinal)
short GetInt16(int ordinal)
virtual ? DataTable GetSchemaTable()
virtual TextReader GetTextReader(int ordinal)
static Task FromException(Exception exception)
Definition Task.cs:3341
static Task FromCanceled(CancellationToken cancellationToken)
Definition Task.cs:3363
static Task CompletedTask
Definition Task.cs:1120
IDataReader GetData(int i)