MySQL Lists are EOL. Please join:

List:Commits« Previous MessageNext Message »
From:Iggy Galarza Date:June 11 2010 1:33pm
Subject:bzr commit into connector-net-6.1 branch (iggy:815) Bug#53097
View as plain text  
#At file:///C:/src/bzr.lp/mine/connectornet/6.1/ based on revid:vvaintroub@stripped

  815 Iggy Galarza	2010-06-11 [merge]
      Bug #53097  	Connection.Ping() closes connection if executed on a connection with datareader
      - Added check for existing DataReader to Ping().

    modified:
      MySql.Data/Provider/Source/Connection.cs
      MySql.Data/Tests/Source/ConnectionTests.cs
=== modified file 'MySql.Data/Provider/Source/Connection.cs'
--- a/MySql.Data/Provider/Source/Connection.cs	2010-04-22 15:29:22 +0000
+++ b/MySql.Data/Provider/Source/Connection.cs	2010-06-11 01:28:35 +0000
@@ -428,6 +428,8 @@ namespace MySql.Data.MySqlClient
         /// <returns></returns>
         public bool Ping()
         {
+            if(dataReader != null)
+                throw new MySqlException(Resources.DataReaderOpen);
             if (driver != null && driver.Ping())
                 return true;
             driver = null;

=== modified file 'MySql.Data/Tests/Source/ConnectionTests.cs'
--- a/MySql.Data/Tests/Source/ConnectionTests.cs	2009-08-31 19:32:51 +0000
+++ b/MySql.Data/Tests/Source/ConnectionTests.cs	2010-06-11 01:28:35 +0000
@@ -21,6 +21,7 @@
 using System;
 using System.Data;
 using MySql.Data.MySqlClient;
+using MySql.Data.MySqlClient.Properties;
 using NUnit.Framework;
 using System.Configuration;
 
@@ -451,6 +452,29 @@ namespace MySql.Data.MySqlClient.Tests
         }
 
         /// <summary>
+        /// Bug #53097  	Connection.Ping() closes connection if executed on a connection with datareader
+        /// </summary>
+        [Test]
+        public void PingWhileReading()
+        {
+            MySqlCommand command = new MySqlCommand("USE mysql; SELECT * FROM help_topic", conn);
+
+            using (MySqlDataReader reader = command.ExecuteReader())
+            {
+                reader.Read();
+                try
+                {
+                    conn.Ping();
+                    Assert.Fail("Test Failed.");
+                }
+                catch (MySqlException ex)
+                {
+                    Assert.AreEqual(Resources.DataReaderOpen, ex.Message);
+                }
+            }
+        }
+
+        /// <summary>
         /// Test if keepalive parameters work.
         /// </summary>
         [Test]


Attachment: [text/bzr-bundle] bzr/iggy@mysql.com-20100611133345-ab9qfjh8412pzpgj.bundle
Thread
bzr commit into connector-net-6.1 branch (iggy:815) Bug#53097Iggy Galarza11 Jun