3using System.Data.SqlClient;
4using System.Threading.Tasks;
18 private readonly SqlCommand 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 SqlParameter Parameter = this.command.Parameters[i];
96 switch (Parameter.SqlDbType)
98 case SqlDbType.Binary:
101 case SqlDbType.DateTime:
102 case SqlDbType.Float:
103 case SqlDbType.Image:
104 case SqlDbType.NChar:
105 case SqlDbType.NText:
106 case SqlDbType.NVarChar:
107 case SqlDbType.UniqueIdentifier:
108 case SqlDbType.SmallDateTime:
110 case SqlDbType.Timestamp:
111 case SqlDbType.VarBinary:
112 case SqlDbType.VarChar:
113 case SqlDbType.Variant:
116 case SqlDbType.Structured:
119 case SqlDbType.DateTime2:
120 case SqlDbType.DateTimeOffset:
122 Parameter.Value = Value;
125 case SqlDbType.Decimal:
126 case SqlDbType.SmallMoney:
127 case SqlDbType.Money:
128 if (Value is decimal Decimal)
129 Parameter.Value = Decimal;
130 else if (Value is
double d)
131 Parameter.Value = (decimal)d;
133 Parameter.Value = Convert.ToDecimal(Value);
137 if (Value is
float Single)
138 Parameter.Value = Single;
139 else if (Value is
double d)
140 Parameter.Value = (float)d;
142 Parameter.Value = Convert.ToSingle(Value);
145 case SqlDbType.SmallInt:
146 if (Value is Int16 Int16)
147 Parameter.Value = Int16;
148 else if (Value is
double d)
149 Parameter.Value = (Int16)d;
151 Parameter.Value = Convert.ToInt16(Value);
155 if (Value is Int32 Int32)
156 Parameter.Value = Int32;
157 else if (Value is
double d)
158 Parameter.Value = (Int32)d;
160 Parameter.Value = Convert.ToInt32(Value);
163 case SqlDbType.BigInt:
164 if (Value is Int64 Int64)
165 Parameter.Value = Int64;
166 else if (Value is
double d)
167 Parameter.Value = (Int64)d;
169 Parameter.Value = Convert.ToInt64(Value);
172 case SqlDbType.TinyInt:
173 if (Value is
byte UI8)
174 Parameter.Value = UI8;
175 else if (Value is
double d)
176 Parameter.Value = (byte)d;
178 Parameter.Value = Convert.ToByte(Value);
183 SqlDataReader Reader = await this.command.ExecuteReaderAsync();
185 return await Reader.ParseAndClose();
189 await this.synchObj.EndWrite();
Represents an object that allows single concurrent writers but multiple concurrent readers....
Represents a stored precedure in a MS SQL Database.
IElement Evaluate(IElement[] Arguments, Variables Variables)
Evaluates the lambda expression.
async Task< IElement > EvaluateAsync(IElement[] Arguments, Variables Variables)
Evaluates the lambda expression.
bool IsAsynchronous
If the node (or its decendants) include asynchronous evaluation. Asynchronous nodes should be evaluat...
string[] ArgumentNames
Argument Names.
int NrArguments
Number of arguments.
void Dispose()
IDisposable.Dispose
override string ToString()
ArgumentType[] ArgumentTypes
Argument types.
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.