2using System.Data.Common;
3using System.Data.OleDb;
4using System.Threading.Tasks;
18 private readonly OleDbCommand command;
19 private readonly
int nrParameters;
20 private readonly
string[] parameterNames;
26 this.command = Command;
27 this.nrParameters = this.command.Parameters.Count;
28 this.parameterNames =
new string[this.nrParameters];
29 this.parameterTypes =
new ArgumentType[this.nrParameters];
31 for (
int i = 0; i < this.nrParameters; i++)
33 this.parameterNames[i] = this.command.Parameters[i].ParameterName;
64 this.command?.Dispose();
88 await this.synchObj.BeginWrite();
91 for (i = 0; i < this.nrParameters; i++)
93 OleDbParameter Parameter = this.command.Parameters[i];
96 switch (Parameter.OleDbType)
99 case OleDbType.Double:
102 case OleDbType.IDispatch:
103 case OleDbType.Error:
104 case OleDbType.Boolean:
105 case OleDbType.Variant:
106 case OleDbType.IUnknown:
107 case OleDbType.Filetime:
109 case OleDbType.Binary:
111 case OleDbType.WChar:
112 case OleDbType.DBDate:
113 case OleDbType.DBTime:
114 case OleDbType.DBTimeStamp:
115 case OleDbType.PropVariant:
116 case OleDbType.VarChar:
117 case OleDbType.LongVarChar:
118 case OleDbType.VarWChar:
119 case OleDbType.LongVarWChar:
120 case OleDbType.VarBinary:
121 case OleDbType.LongVarBinary:
123 Parameter.Value = Value;
126 case OleDbType.Decimal:
127 case OleDbType.Currency:
128 case OleDbType.Numeric:
129 case OleDbType.VarNumeric:
130 if (Value is decimal Decimal)
131 Parameter.Value = Decimal;
132 else if (Value is
double d)
133 Parameter.Value = (decimal)d;
135 Parameter.Value = Convert.ToDecimal(Value);
138 case OleDbType.Single:
139 if (Value is
float Single)
140 Parameter.Value = Single;
141 else if (Value is
double d)
142 Parameter.Value = (float)d;
144 Parameter.Value = Convert.ToSingle(Value);
147 case OleDbType.SmallInt:
148 if (Value is Int16 Int16)
149 Parameter.Value = Int16;
150 else if (Value is
double d)
151 Parameter.Value = (Int16)d;
153 Parameter.Value = Convert.ToInt16(Value);
156 case OleDbType.Integer:
157 if (Value is Int32 Int32)
158 Parameter.Value = Int32;
159 else if (Value is
double d)
160 Parameter.Value = (Int32)d;
162 Parameter.Value = Convert.ToInt32(Value);
165 case OleDbType.BigInt:
166 if (Value is Int64 Int64)
167 Parameter.Value = Int64;
168 else if (Value is
double d)
169 Parameter.Value = (Int64)d;
171 Parameter.Value = Convert.ToInt64(Value);
174 case OleDbType.TinyInt:
175 if (Value is sbyte I8)
176 Parameter.Value = I8;
177 else if (Value is
double d)
178 Parameter.Value = (sbyte)d;
180 Parameter.Value = Convert.ToSByte(Value);
183 case OleDbType.UnsignedTinyInt:
184 if (Value is
byte UI8)
185 Parameter.Value = UI8;
186 else if (Value is
double d)
187 Parameter.Value = (byte)d;
189 Parameter.Value = Convert.ToByte(Value);
192 case OleDbType.UnsignedSmallInt:
193 if (Value is UInt16 UI16)
194 Parameter.Value = UI16;
195 else if (Value is
double d)
196 Parameter.Value = (UInt16)d;
198 Parameter.Value = Convert.ToUInt16(Value);
201 case OleDbType.UnsignedInt:
202 if (Value is UInt32 UI32)
203 Parameter.Value = UI32;
204 else if (Value is
double d)
205 Parameter.Value = (UInt32)d;
207 Parameter.Value = Convert.ToUInt32(Value);
210 case OleDbType.UnsignedBigInt:
211 if (Value is UInt64 UI64)
212 Parameter.Value = UI64;
213 else if (Value is
double d)
214 Parameter.Value = (UInt64)d;
216 Parameter.Value = Convert.ToUInt64(Value);
221 DbDataReader Reader = await this.command.ExecuteReaderAsync();
223 return await Reader.ParseAndClose();
227 await this.synchObj.EndWrite();
Represents an object that allows single concurrent writers but multiple concurrent readers....
Represents a stored precedure in an OLE DB Database.
ArgumentType[] ArgumentTypes
Argument types.
IElement Evaluate(IElement[] Arguments, Variables Variables)
Evaluates the lambda expression.
override string ToString()
void Dispose()
IDisposable.Dispose
async Task< IElement > EvaluateAsync(IElement[] Arguments, Variables Variables)
Evaluates the lambda expression.
int NrArguments
Number of arguments.
bool IsAsynchronous
If the node (or its decendants) include asynchronous evaluation. Asynchronous nodes should be evaluat...
string[] ArgumentNames
Argument Names.
override string ToString()
Basic interface for all types of elements.
object AssociatedObjectValue
Associated object value.
Base interface for lambda expressions.
ArgumentType
Type of parameter used in a function definition or a lambda definition.