List:Commits« Previous MessageNext Message »
From:rburnett Date:June 6 2008 5:37pm
Subject:Connector/NET commit: r1313 - in trunk: . MySql.Data/Provider/Source MySql.Data/Tests/Source
View as plain text  
Modified:
   trunk/CHANGES
   trunk/MySql.Data/Provider/Source/datareader.cs
   trunk/MySql.Data/Tests/Source/DataReaderTests.cs
Log:
merged

Modified: trunk/CHANGES
===================================================================
--- trunk/CHANGES	2008-06-06 15:29:44 UTC (rev 1312)
+++ trunk/CHANGES	2008-06-06 15:37:42 UTC (rev 1313)
@@ -3,11 +3,6 @@
 - Improved sql tokenizing speed greatly.  Patch submitted by Maxim Mass (bug #36836)
 - Fixed possible overflow bug in MySqlPacket.ReadLong (bug #36997)
 
-
-
-
-
-
 Version 5.2.3
 - Increased the speed of MySqlDataReader.GetOrdinal dramatically by using a couple
   of hashes for lookups
@@ -17,6 +12,8 @@
   then we select on the mysql.proc table directly as this is up to 50x faster than our
current
   IS implementation.  If 'use procedure bodies=false', then the IS collection is queried.
   (bug #36694)
+- Fixed problem with our GetOrdinal speedup where we would attempt to add an already
existing
+  key to a hash when a resultset had more than 1 column with the same name. (bug #37239) 
  
     
 Version 5.2.2 - 
 - Fixed profile provider that would throw an exception if you were updating

Modified: trunk/MySql.Data/Provider/Source/datareader.cs
===================================================================
--- trunk/MySql.Data/Provider/Source/datareader.cs	2008-06-06 15:29:44 UTC (rev 1312)
+++ trunk/MySql.Data/Provider/Source/datareader.cs	2008-06-06 15:37:42 UTC (rev 1313)
@@ -858,8 +858,12 @@
 				values = new IMySqlValue[fields.Length];
 				for (int i = 0; i < fields.Length; i++)
 				{
-					fieldHashCS.Add(fields[i].ColumnName, i);
-					fieldHashCI.Add(fields[i].ColumnName, i);
+                    string columnName = fields[i].ColumnName;
+                    if (!fieldHashCS.ContainsKey(columnName))
+                    {
+                        fieldHashCS.Add(columnName, i);
+                        fieldHashCI.Add(columnName, i);
+                    }
 					values[i] = fields[i].GetValueObject();
 				}
 				hasRead = false;

Modified: trunk/MySql.Data/Tests/Source/DataReaderTests.cs
===================================================================
--- trunk/MySql.Data/Tests/Source/DataReaderTests.cs	2008-06-06 15:29:44 UTC (rev 1312)
+++ trunk/MySql.Data/Tests/Source/DataReaderTests.cs	2008-06-06 15:37:42 UTC (rev 1313)
@@ -702,5 +702,25 @@
                 }
             }
 		}
-	}
+
+        /// <summary>
+        /// Bug #37239 MySqlReader GetOrdinal performance changes break existing
functionality
+        /// </summary>
+        [Test]
+        public void ColumnsWithSameName()
+        {
+            CreateDefaultTable();
+            execSQL("INSERT INTO Test (id, name) VALUES (1, 'test')");
+
+            MySqlCommand cmd = new MySqlCommand("SELECT a.name, a.name FROM Test a",
conn);
+            using (MySqlDataReader reader = cmd.ExecuteReader())
+            {
+                reader.Read();
+                string name1 = reader.GetString(0);
+                string name2 = reader.GetString(1);
+                Assert.AreEqual(name1, name2);
+                Assert.AreEqual(name1, "test");
+            }
+        }
+    }
 }

Thread
Connector/NET commit: r1313 - in trunk: . MySql.Data/Provider/Source MySql.Data/Tests/Sourcerburnett6 Jun