List:Commits« Previous MessageNext Message »
From:rburnett Date:June 19 2007 5:27pm
Subject:Connector/NET commit: r766 - in branches/5.0: . Driver/Source TestSuite/Source
View as plain text  
Modified:
   branches/5.0/CHANGES
   branches/5.0/Driver/Source/Connection.cs
   branches/5.0/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)


Modified: branches/5.0/CHANGES
===================================================================
--- branches/5.0/CHANGES	2007-06-15 18:05:19 UTC (rev 765)
+++ branches/5.0/CHANGES	2007-06-19 17:27:36 UTC (rev 766)
@@ -12,6 +12,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: branches/5.0/Driver/Source/Connection.cs
===================================================================
--- branches/5.0/Driver/Source/Connection.cs	2007-06-15 18:05:19 UTC (rev 765)
+++ branches/5.0/Driver/Source/Connection.cs	2007-06-19 17:27:36 UTC (rev 766)
@@ -50,6 +50,7 @@
         private PerformanceMonitor perfMonitor;
         private MySqlPromotableTransaction currentTransaction;
         private bool isExecutingBuggyQuery;
+        private string database;
 
         /// <include file='docs/MySqlConnection.xml' path='docs/InfoMessage/*'/>
         public event MySqlInfoMessageEventHandler InfoMessage;
@@ -173,7 +174,7 @@
 #endif
         public override string Database
         {
-            get { return settings.Database; }
+            get { return database; }
         }
 
         /// <summary>
@@ -251,6 +252,10 @@
                 }
 
                 settings = newSettings;
+
+                if (settings.Database != null && settings.Database.Length > 0)
+                    this.database = settings.Database;
+
                 if (driver != null)
                     driver.Settings = newSettings;
             }
@@ -343,7 +348,7 @@
                 throw new InvalidOperationException(Resources.ConnectionNotOpen);
 
             driver.SetDatabase(database);
-            settings.Database = database;
+            this.database = database;
         }
 
         internal void SetState(ConnectionState newConnectionState)

Modified: branches/5.0/TestSuite/Source/ConnectionTests.cs
===================================================================
--- branches/5.0/TestSuite/Source/ConnectionTests.cs	2007-06-15 18:05:19 UTC (rev 765)
+++ branches/5.0/TestSuite/Source/ConnectionTests.cs	2007-06-19 17:27:36 UTC (rev 766)
@@ -375,5 +375,27 @@
                 Assert.Fail(e.Message);
             }
         }
+
+        /// <summary>
+        /// Bug #29123  	Connection String grows with each use resulting in OutOfMemoryException
+        /// </summary>
+        [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);
+                }
+            }
+        }
     }
 }

Thread
Connector/NET commit: r766 - in branches/5.0: . Driver/Source TestSuite/Sourcerburnett19 Jun