From: Date: June 6 2008 5:29pm Subject: Connector/NET commit: r1312 - in branches/5.2: . MySql.Data/Provider/Source MySql.Data/Tests/Source List-Archive: http://lists.mysql.com/commits/47541 X-Bug: 37239 Message-Id: <200806061529.m56FTiTM026974@bk-internal.mysql.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Modified: branches/5.2/CHANGES branches/5.2/MySql.Data/Provider/Source/datareader.cs branches/5.2/MySql.Data/Tests/Source/DataReaderTests.cs Log: - 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) Modified: branches/5.2/CHANGES =================================================================== --- branches/5.2/CHANGES 2008-06-03 21:40:06 UTC (rev 1311) +++ branches/5.2/CHANGES 2008-06-06 15:29:44 UTC (rev 1312) @@ -7,6 +7,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: branches/5.2/MySql.Data/Provider/Source/datareader.cs =================================================================== --- branches/5.2/MySql.Data/Provider/Source/datareader.cs 2008-06-03 21:40:06 UTC (rev 1311) +++ branches/5.2/MySql.Data/Provider/Source/datareader.cs 2008-06-06 15:29:44 UTC (rev 1312) @@ -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: branches/5.2/MySql.Data/Tests/Source/DataReaderTests.cs =================================================================== --- branches/5.2/MySql.Data/Tests/Source/DataReaderTests.cs 2008-06-03 21:40:06 UTC (rev 1311) +++ branches/5.2/MySql.Data/Tests/Source/DataReaderTests.cs 2008-06-06 15:29:44 UTC (rev 1312) @@ -902,5 +902,24 @@ c2.Dispose(); } } - } + + /// + /// Bug #37239 MySqlReader GetOrdinal performance changes break existing functionality + /// + [Test] + public void ColumnsWithSameName() + { + 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"); + } + } + } }