270
/// Bug #45978 Silent problem when net_write_timeout is exceeded
273
public void NetWriteTimeoutExpiring()
275
execSQL("CREATE TABLE Test(id int, blob1 longblob)");
277
byte[] b1 = Utils.CreateBlob(5000);
278
MySqlCommand cmd = new MySqlCommand("INSERT INTO Test VALUES (@id, @b1)", conn);
279
cmd.Parameters.Add("@id", MySqlDbType.Int32);
280
cmd.Parameters.AddWithValue("@name", b1);
281
for (int i = 0; i < 10000; i++)
283
cmd.Parameters[0].Value = i;
284
cmd.ExecuteNonQuery();
287
string connStr = GetConnectionString(true);
288
using (MySqlConnection c = new MySqlConnection(connStr))
292
cmd.Parameters.Clear();
293
cmd.CommandText = "SET net_write_timeout = 1";
294
cmd.ExecuteNonQuery();
296
cmd.CommandText = "SELECT * FROM Test LIMIT 100000";
297
using (MySqlDataReader reader = cmd.ExecuteReader())
300
// after this several cycles of DataReader.Read() are executed
301
// normally and then the problem, described above, occurs
305
while (reader.Read())
307
object o = reader[0];
308
Assert.AreEqual(i++, o);
310
Assert.Fail("This should have failed");
314
string s = ex.Message;