From: Date: June 19 2007 7:29pm Subject: Connector/NET commit: r767 - in trunk: . Driver/Source TestSuite/Source List-Archive: http://lists.mysql.com/commits/29128 X-Bug: 29123, 29123 Message-Id: <200706191729.l5JHTOcL002908@bk-internal.mysql.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Modified: trunk/CHANGES trunk/Driver/Source/Connection.cs trunk/TestSuite/Source/ConnectionTests.cs Log: Bug #29123 Connection String grows with each use resulting in OutOfMemoryException Changed behavior of ConnectionString property. It now only returns the connection string given to it. It will not attempt to track changes to the current database when the users uses the ChangeDatabase method. (Bug #29123) [merged from 5.0] Modified: trunk/CHANGES =================================================================== --- trunk/CHANGES 2007-06-19 17:27:36 UTC (rev 766) +++ trunk/CHANGES 2007-06-19 17:29:23 UTC (rev 767) @@ -47,6 +47,9 @@ - Fixed problem where usage advisor warnings for unnecessary field conversions and not reading all rows of a resultset would output even if you did not request usage advisor warnings. (Bug #29124) + - Changed behavior of ConnectionString property. It now only returns the connection + string given to it. It will not attempt to track changes to the current + database when the users uses the ChangeDatabase method. (Bug #29123) Version 5.0.7 5/16/2007 Modified: trunk/Driver/Source/Connection.cs =================================================================== --- trunk/Driver/Source/Connection.cs 2007-06-19 17:27:36 UTC (rev 766) +++ trunk/Driver/Source/Connection.cs 2007-06-19 17:29:23 UTC (rev 767) @@ -54,6 +54,7 @@ private MySqlPromotableTransaction currentTransaction; #endif private bool isExecutingBuggyQuery; + private string database; /// public event MySqlInfoMessageEventHandler InfoMessage; @@ -184,7 +185,7 @@ #endif public override string Database { - get { return settings.Database; } + get { return database; } } /// @@ -263,6 +264,10 @@ } settings = newSettings; + + if (settings.Database != null && settings.Database.Length > 0) + this.database = settings.Database; + if (driver != null) driver.Settings = newSettings; } @@ -358,7 +363,7 @@ throw new InvalidOperationException(Resources.ConnectionNotOpen); driver.SetDatabase(database); - settings.Database = database; + this.database = database; } internal void SetState(ConnectionState newConnectionState) Modified: trunk/TestSuite/Source/ConnectionTests.cs =================================================================== --- trunk/TestSuite/Source/ConnectionTests.cs 2007-06-19 17:27:36 UTC (rev 766) +++ trunk/TestSuite/Source/ConnectionTests.cs 2007-06-19 17:29:23 UTC (rev 767) @@ -387,5 +387,27 @@ Assert.Fail(e.Message); } } + + /// + /// Bug #29123 Connection String grows with each use resulting in OutOfMemoryException + /// + [Test] + public void ConnectionStringNotAffectedByChangeDatabase() + { + for (int i = 0; i < 10; i++) + { + string connStr = GetConnectionString(true) + ";pooling=false"; + connStr = connStr.Replace("database", "Initial Catalog"); + connStr = connStr.Replace("persist security info=true", + "persist security info=false"); + using (MySqlConnection c = new MySqlConnection(connStr)) + { + c.Open(); + string str = c.ConnectionString; + int index = str.IndexOf("Database="); + Assert.AreEqual(-1, index); + } + } + } } }