Modified:
branches/5.0/CHANGES
branches/5.0/Driver/Source/MySqlStream.cs
branches/5.0/TestSuite/Source/DataAdapterTests.cs
Log:
Fixed problem where any attempt to not read all the records returned from a select
where each row of the select is > 1024 bytes will hang the driver.
Modified: branches/5.0/CHANGES
===================================================================
--- branches/5.0/CHANGES 2007-06-14 16:36:44 UTC (rev 761)
+++ branches/5.0/CHANGES 2007-06-15 17:51:11 UTC (rev 762)
@@ -6,6 +6,9 @@
that we read the compressed data into before inflating. (Bug #28204)
- Fixed problem where we were not closing prepared statement handles
when commands are disposed.
+ - Fixed problem where any attempt to not read all the records returned
+ from a select where each row of the select is greater than 1024 bytes
+ would hang the driver.
Version 5.0.7 5/16/2007
Modified: branches/5.0/Driver/Source/MySqlStream.cs
===================================================================
--- branches/5.0/Driver/Source/MySqlStream.cs 2007-06-14 16:36:44 UTC (rev 761)
+++ branches/5.0/Driver/Source/MySqlStream.cs 2007-06-15 17:51:11 UTC (rev 762)
@@ -210,8 +210,7 @@
{
int toRead = (int)Math.Min((ulong)tempBuf.Length, (inLength - inPos));
Read(tempBuf, 0, toRead);
- inPos += (ulong)toRead;
- }
+ }
}
/// <summary>
@@ -319,6 +318,7 @@
{
buffer[offset++] = (byte)ReadByte();
count--;
+ totalRead++;
continue;
}
Modified: branches/5.0/TestSuite/Source/DataAdapterTests.cs
===================================================================
--- branches/5.0/TestSuite/Source/DataAdapterTests.cs 2007-06-14 16:36:44 UTC (rev 761)
+++ branches/5.0/TestSuite/Source/DataAdapterTests.cs 2007-06-15 17:51:11 UTC (rev 762)
@@ -677,5 +677,41 @@
da.Fill(0, 10, dt);
Assert.AreEqual(10, dt.Rows.Count);
}
- }
+
+ private string MakeLargeString(int len)
+ {
+ System.Text.StringBuilder sb = new System.Text.StringBuilder(len);
+ while (len-- > 0)
+ sb.Append('a');
+ return sb.ToString();
+ }
+
+ [Test]
+ public void SkippingRowsLargerThan1024()
+ {
+ execSQL("DROP TABLE IF EXISTS test");
+ execSQL("CREATE TABLE test (id INT, name TEXT)");
+
+ MySqlCommand cmd = new MySqlCommand("INSERT INTO test VALUES (?id, ?name)", conn);
+ cmd.Parameters.Add("?id", MySqlDbType.Int32);
+ cmd.Parameters.Add("?name", MySqlDbType.Text);
+ for (int i = 0; i < 5; i++)
+ {
+ cmd.Parameters[0].Value = i;
+ cmd.Parameters[1].Value = MakeLargeString(2000);
+ cmd.ExecuteNonQuery();
+ }
+
+ try
+ {
+ MySqlDataAdapter da = new MySqlDataAdapter("SELECT * FROM test", conn);
+ DataTable dt = new DataTable();
+ da.Fill(0, 2, dt);
+ }
+ catch (Exception ex)
+ {
+ Assert.Fail(ex.Message);
+ }
+ }
+ }
}
| Thread |
|---|
| • Connector/NET commit: r762 - in branches/5.0: . Driver/Source TestSuite/Source | rburnett | 15 Jun |