From: Date: July 8 2008 8:06pm Subject: Connector/NET commit: r1329 - in branches/5.0: . Driver/Source TestSuite/Source List-Archive: http://lists.mysql.com/commits/49228 X-Bug: 37955 Message-Id: <200807081806.m68I62Nf002720@bk-internal.mysql.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Modified: branches/5.0/CHANGES branches/5.0/Driver/Source/MySqlConnectionStringBuilder.cs branches/5.0/TestSuite/Source/ConnectionStringBuilder.cs Log: - Fixed MySqlConnectionStringBuilder to first remove old keyword settings when setting a value that was previously set (bug #37955) Modified: branches/5.0/CHANGES =================================================================== --- branches/5.0/CHANGES 2008-07-08 16:37:50 UTC (rev 1328) +++ branches/5.0/CHANGES 2008-07-08 18:06:02 UTC (rev 1329) @@ -5,6 +5,8 @@ a non-existant pool. (bug #36432) - Fixed problem where supplying the connection reset config option can cause login to fail when there is room to make a new connection and the pool has no idle connections. + - Fixed MySqlConnectionStringBuilder to first remove old keyword settings when setting + a value that was previously set (bug #37955) Version 5.0.9 - 4/14/08 Modified: branches/5.0/Driver/Source/MySqlConnectionStringBuilder.cs =================================================================== --- branches/5.0/Driver/Source/MySqlConnectionStringBuilder.cs 2008-07-08 16:37:50 UTC (rev 1328) +++ branches/5.0/Driver/Source/MySqlConnectionStringBuilder.cs 2008-07-08 18:06:02 UTC (rev 1329) @@ -944,11 +944,18 @@ { if (value == null) throw new ArgumentException(Resources.KeywordNoNull, keyword); + object out_obj; + TryGetValue(keyword, out out_obj); + Keyword kw = GetKey(keyword); SetValue(kw, value); base[keyword] = value; if (kw != Keyword.Password) + { + /* Nothing bad happens if the substring is not found */ + persistConnString.Replace(keyword + "=" + out_obj + ";", ""); persistConnString.AppendFormat("{0}={1};", keyword, value); + } } private void SetValue(Keyword kw, object value) Modified: branches/5.0/TestSuite/Source/ConnectionStringBuilder.cs =================================================================== --- branches/5.0/TestSuite/Source/ConnectionStringBuilder.cs 2008-07-08 16:37:50 UTC (rev 1328) +++ branches/5.0/TestSuite/Source/ConnectionStringBuilder.cs 2008-07-08 18:06:02 UTC (rev 1329) @@ -94,5 +94,17 @@ Assert.IsFalse(sb.UsePerformanceMonitor); Assert.AreEqual(25, sb.ProcedureCacheSize); } + + /// + /// Bug #37955 Connector/NET keeps adding the same option to the connection string + /// + [Test] + public void SettingValueMultipeTimes() + { + MySqlConnectionStringBuilder s = new MySqlConnectionStringBuilder(); + s["database"] = "test"; + s["database"] = "test2"; + Assert.AreEqual("database=test2", s.GetConnectionString(false)); + } } }