List:Commits« Previous MessageNext Message »
From:Reggie Burnett Date:December 14 2010 3:14pm
Subject:bzr commit into connector-net-6.1 branch (reggie.burnett:867)
View as plain text  
#At file:///C:/Documents%20and%20Settings/Reggie/work/connector-net/6.1/ based on revid:reggie.burnett@stripped

  867 Reggie Burnett	2010-12-14 [merge]
      merged

    modified:
      CHANGES
      MySql.Data/Provider/Source/Driver.cs
      MySql.Data/Provider/Source/datareader.cs
      MySql.Data/Tests/Source/CommandTests.cs
=== modified file 'CHANGES'
=== modified file 'CHANGES'
--- a/CHANGES	2010-12-09 03:35:41 +0000
+++ b/CHANGES	2010-12-14 15:14:30 +0000
@@ -14,6 +14,8 @@
 - fixed bug where older versions of MySQL would present cast(0 as decimal(0,0)) as string 
   that caused our EF code to throw an exception as it tried to convert that to bool
   (bug #55349)
+- change reader to close the connection if CommandBehavior.CloseConnection is given and an
+  exception is generated (bug #58652)
 
 Version 6.1.5
 - Fix authorization popup after modifying stored procedure in VS (Bug #44715)

=== modified file 'MySql.Data/Provider/Source/Driver.cs'
--- a/MySql.Data/Provider/Source/Driver.cs	2010-08-18 19:03:33 +0000
+++ b/MySql.Data/Provider/Source/Driver.cs	2010-12-14 15:14:30 +0000
@@ -50,7 +50,7 @@
         protected Hashtable charSets;
         protected bool hasWarnings;
         protected long maxPacketSize;
-        protected int lastInsertId;
+        protected long lastInsertId;
         protected long affectedRows;
 #if !CF
         protected MySqlPromotableTransaction currentTransaction;
@@ -152,7 +152,7 @@
             get { return affectedRows; }
         }
 
-        public int LastInsertedId
+        public long LastInsertedId
         {
             get { return lastInsertId; }
         }

=== modified file 'MySql.Data/Provider/Source/datareader.cs'
--- a/MySql.Data/Provider/Source/datareader.cs	2010-08-18 19:03:33 +0000
+++ b/MySql.Data/Provider/Source/datareader.cs	2010-12-14 15:14:30 +0000
@@ -877,6 +877,8 @@
                     throw new MySqlException(Resources.Timeout);
                 if (ex.Number == 0)
                     throw new MySqlException(Resources.FatalErrorReadingResult, ex);
+                if ((commandBehavior & CommandBehavior.CloseConnection) != 0)
+                    Close();
                 throw;
             }
 		}

=== modified file 'MySql.Data/Tests/Source/CommandTests.cs'
--- a/MySql.Data/Tests/Source/CommandTests.cs	2010-10-07 21:11:14 +0000
+++ b/MySql.Data/Tests/Source/CommandTests.cs	2010-12-14 15:14:30 +0000
@@ -444,6 +444,29 @@
             {
             }
         }
+
+        /// <summary>
+        /// Bug #58652	ExecuteReader throws NullReferenceException when using CommandBehavior.Close
+        /// </summary>
+        [Test]
+        public void SyntaxErrorWithCloseConnection()
+        {
+            string connStr = GetConnectionString(true);
+            using (MySqlConnection c = new MySqlConnection(connStr))
+            {
+                c.Open();
+                MySqlCommand cmd = new MySqlCommand("SELE 1", c);
+                try
+                {
+                    cmd.ExecuteReader(CommandBehavior.CloseConnection);
+                    Assert.Fail("This should have failed");
+                }
+                catch (MySqlException)
+                {
+                }
+                Assert.IsTrue(c.State == ConnectionState.Closed);
+            }
+        }
     }
 
 

No bundle (reason: revision is a merge (you can force generation of a bundle with env var BZR_FORCE_BUNDLE=1)).
Thread
bzr commit into connector-net-6.1 branch (reggie.burnett:867) Reggie Burnett14 Dec