List:Commits« Previous MessageNext Message »
From:rburnett Date:June 15 2007 7:53pm
Subject:Connector/NET commit: r763 - in trunk: . Driver/Source TestSuite/Source
View as plain text  
Modified:
   trunk/CHANGES
   trunk/Driver/Source/MySqlStream.cs
   trunk/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. (merged from 5.0)

Modified: trunk/CHANGES
===================================================================
--- trunk/CHANGES	2007-06-15 17:51:11 UTC (rev 762)
+++ trunk/CHANGES	2007-06-15 17:53:27 UTC (rev 763)
@@ -41,6 +41,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: trunk/Driver/Source/MySqlStream.cs
===================================================================
--- trunk/Driver/Source/MySqlStream.cs	2007-06-15 17:51:11 UTC (rev 762)
+++ trunk/Driver/Source/MySqlStream.cs	2007-06-15 17:53:27 UTC (rev 763)
@@ -209,8 +209,7 @@
 			{
 				int toRead = (int)Math.Min((ulong)tempBuf.Length, (inLength - inPos));
 				Read(tempBuf, 0, toRead);
-				inPos += (ulong)toRead;
-			}
+            }
 		}
 
 		/// <summary>
@@ -318,6 +317,7 @@
 				{
 					buffer[offset++] = (byte)ReadByte();
 					count--;
+                    totalRead++;
 					continue;
 				}
 

Modified: trunk/TestSuite/Source/DataAdapterTests.cs
===================================================================
--- trunk/TestSuite/Source/DataAdapterTests.cs	2007-06-15 17:51:11 UTC (rev 762)
+++ trunk/TestSuite/Source/DataAdapterTests.cs	2007-06-15 17:53:27 UTC (rev 763)
@@ -671,5 +671,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: r763 - in trunk: . Driver/Source TestSuite/Sourcerburnett15 Jun