@@ -37,7 +37,7 @@ public void Execute(int step, int method)
37
37
connection . Open ( ) ;
38
38
using var command = connection . CreateCommand ( ) ;
39
39
command . CommandTimeout = 1 ;
40
- command . CommandText = $ "SELECT { 4000 + step } ;";
40
+ command . CommandText = $ "SELECT 0, 4000, { step } , 1 ;";
41
41
var stopwatch = Stopwatch . StartNew ( ) ;
42
42
var ex = Assert . Throws < MySqlException > ( ( ) => s_executeMethods [ method ] ( command ) ) ;
43
43
Assert . InRange ( stopwatch . ElapsedMilliseconds , 900 , 1500 ) ;
@@ -59,7 +59,7 @@ public async Task ExecuteAsyncs(int step, int method)
59
59
connection . Open ( ) ;
60
60
using var command = connection . CreateCommand ( ) ;
61
61
command . CommandTimeout = 1 ;
62
- command . CommandText = $ "SELECT { 4000 + step } ;";
62
+ command . CommandText = $ "SELECT 0, 4000, { step } , 1 ;";
63
63
var stopwatch = Stopwatch . StartNew ( ) ;
64
64
var ex = await Assert . ThrowsAsync < MySqlException > ( async ( ) => await s_executeAsyncMethods [ method ] ( command , default ) ) ;
65
65
Assert . InRange ( stopwatch . ElapsedMilliseconds , 900 , 1500 ) ;
@@ -84,7 +84,7 @@ public void Execute(int step, int method)
84
84
connection . Open ( ) ;
85
85
using var command = connection . CreateCommand ( ) ;
86
86
command . CommandTimeout = 10 ;
87
- command . CommandText = $ "SELECT { 4000 + step } ;";
87
+ command . CommandText = $ "SELECT 0, 4000, { step } , 1 ;";
88
88
var task = Task . Run ( async ( ) =>
89
89
{
90
90
await Task . Delay ( TimeSpan . FromSeconds ( 1 ) ) ;
@@ -111,7 +111,7 @@ public async Task ExecuteAsync(int step, int method)
111
111
connection . Open ( ) ;
112
112
using var command = connection . CreateCommand ( ) ;
113
113
command . CommandTimeout = 10 ;
114
- command . CommandText = $ "SELECT { 4000 + step } ;";
114
+ command . CommandText = $ "SELECT 0, 4000, { step } , 1 ;";
115
115
var task = Task . Run ( async ( ) =>
116
116
{
117
117
await Task . Delay ( TimeSpan . FromSeconds ( 1 ) ) ;
@@ -141,7 +141,7 @@ public async Task Test(int step, int method)
141
141
connection . Open ( ) ;
142
142
using var command = connection . CreateCommand ( ) ;
143
143
command . CommandTimeout = 0 ;
144
- command . CommandText = $ "SELECT { 4000 + step } ;";
144
+ command . CommandText = $ "SELECT 0, 4000, { step } , 1 ;";
145
145
using var source = new CancellationTokenSource ( TimeSpan . FromSeconds ( 1 ) ) ;
146
146
var stopwatch = Stopwatch . StartNew ( ) ;
147
147
var ex = await Assert . ThrowsAsync < OperationCanceledException > ( async ( ) => await s_executeAsyncMethods [ method ] ( command , source . Token ) ) ;
@@ -166,14 +166,13 @@ public void Test(int step, int method)
166
166
connection . Open ( ) ;
167
167
using var command = connection . CreateCommand ( ) ;
168
168
command . CommandTimeout = 1 ;
169
- var expected = 100 + step ;
170
- command . CommandText = $ "SELECT { expected } ;";
169
+ command . CommandText = $ "SELECT 42, 100, { step } , 1;";
171
170
var stopwatch = Stopwatch . StartNew ( ) ;
172
171
var result = s_executeMethods [ method ] ( command ) ;
173
172
if ( method == 1 )
174
173
Assert . Equal ( 0 , result ) ; // ExecuteNonQuery
175
174
else
176
- Assert . Equal ( expected , result ) ;
175
+ Assert . Equal ( 42 , result ) ;
177
176
Assert . InRange ( stopwatch . ElapsedMilliseconds , 50 , 250 ) ;
178
177
}
179
178
}
@@ -188,15 +187,14 @@ public async Task Test(int step, int method)
188
187
connection . Open ( ) ;
189
188
using var command = connection . CreateCommand ( ) ;
190
189
command . CommandTimeout = 0 ;
191
- var expected = 100 + step ;
192
- command . CommandText = $ "SELECT { expected } ;";
190
+ command . CommandText = $ "SELECT 42, 100, { step } , 1;";
193
191
using var source = new CancellationTokenSource ( TimeSpan . FromSeconds ( 1 ) ) ;
194
192
var stopwatch = Stopwatch . StartNew ( ) ;
195
193
var result = await s_executeAsyncMethods [ method ] ( command , source . Token ) ;
196
194
if ( method == 1 )
197
195
Assert . Equal ( 0 , result ) ; // ExecuteNonQuery
198
196
else
199
- Assert . Equal ( expected , result ) ;
197
+ Assert . Equal ( 42 , result ) ;
200
198
Assert . InRange ( stopwatch . ElapsedMilliseconds , 50 , 250 ) ;
201
199
}
202
200
}
@@ -212,7 +210,7 @@ public void Timeout(int method)
212
210
connection . Open ( ) ;
213
211
using var command = connection . CreateCommand ( ) ;
214
212
command . CommandTimeout = 1 ;
215
- command . CommandText = $ "SELECT 100;";
213
+ command . CommandText = $ "SELECT 0, 100, -1, 1 ;";
216
214
var stopwatch = Stopwatch . StartNew ( ) ;
217
215
var ex = Assert . Throws < MySqlException > ( ( ) => s_executeMethods [ method ] ( command ) ) ;
218
216
Assert . InRange ( stopwatch . ElapsedMilliseconds , 900 , 1500 ) ;
@@ -229,10 +227,10 @@ public void NoTimeout(int method)
229
227
connection . Open ( ) ;
230
228
using var command = connection . CreateCommand ( ) ;
231
229
command . CommandTimeout = 1 ;
232
- command . CommandText = $ "SELECT 100;";
230
+ command . CommandText = $ "SELECT 42, 100, -1, 1 ;";
233
231
var stopwatch = Stopwatch . StartNew ( ) ;
234
232
var result = s_executeMethods [ method ] ( command ) ;
235
- Assert . Equal ( 100 , result ) ;
233
+ Assert . Equal ( 42 , result ) ;
236
234
Assert . InRange ( stopwatch . ElapsedMilliseconds , 1100 , 1500 ) ;
237
235
}
238
236
}
@@ -248,7 +246,7 @@ public async Task Timeout(int method)
248
246
connection . Open ( ) ;
249
247
using var command = connection . CreateCommand ( ) ;
250
248
command . CommandTimeout = 1 ;
251
- command . CommandText = $ "SELECT 100;";
249
+ command . CommandText = $ "SELECT 0, 100, -1, 1 ;";
252
250
var stopwatch = Stopwatch . StartNew ( ) ;
253
251
var ex = await Assert . ThrowsAsync < MySqlException > ( async ( ) => await s_executeAsyncMethods [ method ] ( command , default ) ) ;
254
252
Assert . InRange ( stopwatch . ElapsedMilliseconds , 900 , 1500 ) ;
@@ -265,10 +263,10 @@ public async Task NoTimeout(int method)
265
263
connection . Open ( ) ;
266
264
using var command = connection . CreateCommand ( ) ;
267
265
command . CommandTimeout = 1 ;
268
- command . CommandText = $ "SELECT 100;";
266
+ command . CommandText = $ "SELECT 42, 100, -1, 1 ;";
269
267
var stopwatch = Stopwatch . StartNew ( ) ;
270
268
var result = await s_executeAsyncMethods [ method ] ( command , default ) ;
271
- Assert . Equal ( 100 , result ) ;
269
+ Assert . Equal ( 42 , result ) ;
272
270
Assert . InRange ( stopwatch . ElapsedMilliseconds , 1100 , 1500 ) ;
273
271
}
274
272
}
@@ -283,7 +281,7 @@ public void Test(int step, int method)
283
281
connection . Open ( ) ;
284
282
using var command = connection . CreateCommand ( ) ;
285
283
command . CommandTimeout = 1 ;
286
- command . CommandText = $ "SELECT { 10000 + step } ;";
284
+ command . CommandText = $ "SELECT 0, 10000, { step } , 0 ;";
287
285
var stopwatch = Stopwatch . StartNew ( ) ;
288
286
var ex = Assert . Throws < MySqlException > ( ( ) => s_executeMethods [ method ] ( command ) ) ;
289
287
Assert . InRange ( stopwatch . ElapsedMilliseconds , 2900 , 3500 ) ;
@@ -305,7 +303,7 @@ public async Task Test(int step, int method)
305
303
connection . Open ( ) ;
306
304
using var command = connection . CreateCommand ( ) ;
307
305
command . CommandTimeout = 1 ;
308
- command . CommandText = $ "SELECT { 10000 + step } ;";
306
+ command . CommandText = $ "SELECT 0, 10000, { step } , 0 ;";
309
307
var stopwatch = Stopwatch . StartNew ( ) ;
310
308
var ex = await Assert . ThrowsAsync < MySqlException > ( async ( ) => await s_executeAsyncMethods [ method ] ( command , default ) ) ;
311
309
Assert . InRange ( stopwatch . ElapsedMilliseconds , 2900 , 3500 ) ;
@@ -328,7 +326,7 @@ public void Execute(int step, int method)
328
326
connection . Open ( ) ;
329
327
using var command = connection . CreateCommand ( ) ;
330
328
command . CommandTimeout = 1 ;
331
- command . CommandText = $ "SELECT { 10000 + step } ;";
329
+ command . CommandText = $ "SELECT 0, 10000, { step } , 0 ;";
332
330
var stopwatch = Stopwatch . StartNew ( ) ;
333
331
var ex = Assert . Throws < MySqlException > ( ( ) => s_executeMethods [ method ] ( command ) ) ;
334
332
Assert . InRange ( stopwatch . ElapsedMilliseconds , 900 , 1500 ) ;
@@ -348,7 +346,7 @@ public async Task ExecuteAsync(int step, int method)
348
346
connection . Open ( ) ;
349
347
using var command = connection . CreateCommand ( ) ;
350
348
command . CommandTimeout = 1 ;
351
- command . CommandText = $ "SELECT { 10000 + step } ;";
349
+ command . CommandText = $ "SELECT 0, 10000, { step } , 0 ;";
352
350
var stopwatch = Stopwatch . StartNew ( ) ;
353
351
var ex = await Assert . ThrowsAsync < MySqlException > ( async ( ) => await s_executeAsyncMethods [ method ] ( command , default ) ) ;
354
352
Assert . InRange ( stopwatch . ElapsedMilliseconds , 900 , 1500 ) ;
0 commit comments