MySQL Lists are EOL. Please join:

List:Commits« Previous MessageNext Message »
From:rburnett Date:July 23 2007 10:25pm
Subject:Connector/NET commit: r803 - 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/SimpleTransactions.cs
Log:
Fixed problem where MySqlConnection.BeginTransaction checked the drivers
status var before checking if the connection was open.  The result was that the driver could report an invalid condition on a previously opened connection. 

Modified: branches/5.0/CHANGES
===================================================================
--- branches/5.0/CHANGES	2007-07-23 15:15:22 UTC (rev 802)
+++ branches/5.0/CHANGES	2007-07-23 22:25:17 UTC (rev 803)
@@ -27,6 +27,9 @@
   - Fixed bug where Connecor/Net was hand building some date time patterns rather than using
     the patterns provided under CultureInfo.  This caused problems with some calendars that do
     not support the same ranges as Gregorian.  (Bug #29931)
+  - Fixed problem where MySqlConnection.BeginTransaction checked the drivers
+    status var before checking if the connection was open.  The result was that the
+    driver could report an invalid condition on a previously opened connection.    
     
 Version 5.0.7 5/16/2007
 

Modified: branches/5.0/Driver/Source/Connection.cs
===================================================================
--- branches/5.0/Driver/Source/Connection.cs	2007-07-23 15:15:22 UTC (rev 802)
+++ branches/5.0/Driver/Source/Connection.cs	2007-07-23 22:25:17 UTC (rev 803)
@@ -301,14 +301,14 @@
         /// <include file='docs/MySqlConnection.xml' path='docs/BeginTransaction1/*'/>
         public new MySqlTransaction BeginTransaction(IsolationLevel iso)
         {
+            //TODO: check note in help
+            if (State != ConnectionState.Open)
+                throw new InvalidOperationException(Resources.ConnectionNotOpen);
+
             // First check to see if we are in a current transaction
             if ((driver.ServerStatus & ServerStatusFlags.InTransaction) != 0)
                 throw new InvalidOperationException(Resources.NoNestedTransactions);
 
-            //TODO: check note in help
-            if (State != ConnectionState.Open)
-                throw new InvalidOperationException(Resources.ConnectionNotOpen);
-
             MySqlTransaction t = new MySqlTransaction(this, iso);
 
             MySqlCommand cmd = new MySqlCommand("", this);

Modified: branches/5.0/TestSuite/Source/SimpleTransactions.cs
===================================================================
--- branches/5.0/TestSuite/Source/SimpleTransactions.cs	2007-07-23 15:15:22 UTC (rev 802)
+++ branches/5.0/TestSuite/Source/SimpleTransactions.cs	2007-07-23 22:25:17 UTC (rev 803)
@@ -103,5 +103,21 @@
             }
         }
 
+        [Test]
+        public void BeginTransactionOnPreviouslyOpenConnection()
+        {
+            string connStr = GetConnectionString(true);
+            MySqlConnection c = new MySqlConnection(connStr);
+            c.Open();
+            c.Close();
+            try
+            {
+                MySqlTransaction t = c.BeginTransaction();
+            }
+            catch (Exception ex)
+            {
+                Assert.AreEqual("The connection is not open.", ex.Message);
+            }
+        }
 	}
 }

Thread
Connector/NET commit: r803 - in branches/5.0: . Driver/Source TestSuite/Sourcerburnett24 Jul