From: Date: September 26 2006 11:36pm Subject: Connector/NET commit: r364 - in trunk: . TestSuite List-Archive: http://lists.mysql.com/commits/12576 X-Bug: 8131 Message-Id: <200609262136.k8QLaW8x008885@bk-internal.mysql.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Modified: trunk/CHANGES trunk/TestSuite/DataAdapterTests.cs Log: Bug #8131 Data Adapter doesn't close connection This bug was already fixed in 5.0.1 but we add the test case here as well. Modified: trunk/CHANGES =================================================================== --- trunk/CHANGES 2006-09-26 21:35:43 UTC (rev 363) +++ trunk/CHANGES 2006-09-26 21:36:31 UTC (rev 364) @@ -76,6 +76,7 @@ Bug #11991 ExecuteScalar Bug #14592 Wrong column length returned for VARCHAR UTF8 columns Bug #18391 Better error handling for the .NET class "MySqlCommand" needed. + Bug #8131 Data Adapter doesn't close connection Version 1.0.7 Modified: trunk/TestSuite/DataAdapterTests.cs =================================================================== --- trunk/TestSuite/DataAdapterTests.cs 2006-09-26 21:35:43 UTC (rev 363) +++ trunk/TestSuite/DataAdapterTests.cs 2006-09-26 21:36:31 UTC (rev 364) @@ -473,5 +473,44 @@ } } + /// + /// Bug #8131 Data Adapter doesn't close connection + /// + [Test] + public void QuietOpenAndClose() + { + execSQL("DROP TABLE IF EXISTS test"); + execSQL("CREATE TABLE test (id INT, PRIMARY KEY(id))"); + execSQL("INSERT INTO test VALUES(1)"); + + try + { + MySqlConnection c = new MySqlConnection(GetConnectionString(true)); + MySqlDataAdapter da = new MySqlDataAdapter("SELECT * FROM test", c); + MySqlCommandBuilder cb = new MySqlCommandBuilder(da); + Assert.IsTrue(c.State == ConnectionState.Closed); + DataTable dt = new DataTable(); + da.Fill(dt); + Assert.IsTrue(c.State == ConnectionState.Closed); + Assert.AreEqual(1, dt.Rows.Count); + + dt.Rows[0][0] = 2; + DataRow[] rows = new DataRow[1]; + rows[0] = dt.Rows[0]; + da.Update(dt); + Assert.IsTrue(c.State == ConnectionState.Closed); + + dt.Clear(); + c.Open(); + Assert.IsTrue(c.State == ConnectionState.Open); + da.Fill(dt); + Assert.IsTrue(c.State == ConnectionState.Open); + Assert.AreEqual(1, dt.Rows.Count); + } + catch (Exception ex) + { + Assert.Fail(ex.Message); + } + } } }