List:Commits« Previous MessageNext Message »
From:rburnett Date:December 29 2006 4:31pm
Subject:Connector/NET commit: r514 - in trunk: . TestSuite mysqlclient/core mysqlclient/core/docs
View as plain text  
Modified:
   trunk/CHANGES
   trunk/TestSuite/SimpleTransactions.cs
   trunk/mysqlclient/core/Connection.cs
   trunk/mysqlclient/core/docs/MySqlConnection.xml
Log:
Bug #22400 Nested transactions 

Fixed this by checking the server status reported by the server and throwing an exception
if we are in a pending transaction.

Modified: trunk/CHANGES
===================================================================
--- trunk/CHANGES	2006-12-19 18:37:20 UTC (rev 513)
+++ trunk/CHANGES	2006-12-29 15:31:54 UTC (rev 514)
@@ -13,6 +13,7 @@
        information schema.]
   Bug #25013 Return Value parameter not found 
   Bug #25151 Reading from the stream has failed Exception in MySQL Connector 5.0.2 
+  Bug #22400 Nested transactions 
 
   Other changes
   -------------

Modified: trunk/TestSuite/SimpleTransactions.cs
===================================================================
--- trunk/TestSuite/SimpleTransactions.cs	2006-12-19 18:37:20 UTC (rev 513)
+++ trunk/TestSuite/SimpleTransactions.cs	2006-12-29 15:31:54 UTC (rev 514)
@@ -80,7 +80,6 @@
         /// <summary>
         /// Bug #22400 Nested transactions 
         /// </summary>
-        [Category("NotWorking")]
         [Test]
         public void NestedTransactions()
         {
@@ -88,10 +87,10 @@
             try
             {
                 MySqlTransaction t2 = conn.BeginTransaction();
-                t2.Rollback();
                 Assert.Fail("Exception should have been thrown");
+                t2.Rollback();
             }
-            catch (NotSupportedException)
+            catch (InvalidOperationException)
             {
             }
             catch (Exception ex)

Modified: trunk/mysqlclient/core/Connection.cs
===================================================================
--- trunk/mysqlclient/core/Connection.cs	2006-12-19 18:37:20 UTC (rev 513)
+++ trunk/mysqlclient/core/Connection.cs	2006-12-29 15:31:54 UTC (rev 514)
@@ -279,6 +279,10 @@
 		/// <include file='docs/MySqlConnection.xml' path='docs/BeginTransaction1/*'/>
 		public new MySqlTransaction BeginTransaction(IsolationLevel iso)
 		{
+            // 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);

Modified: trunk/mysqlclient/core/docs/MySqlConnection.xml
===================================================================
--- trunk/mysqlclient/core/docs/MySqlConnection.xml	2006-12-19 18:37:20 UTC (rev 513)
+++ trunk/mysqlclient/core/docs/MySqlConnection.xml	2006-12-29 15:31:54 UTC (rev 514)
@@ -242,7 +242,9 @@
 		<para>You must explicitly commit or roll back the transaction using the <see
cref="MySqlTransaction.Commit"/> or 
 		<see cref="MySqlTransaction.Rollback"/> method.
 		<note>If you do not specify an isolation level, the default isolation level is
used. To specify an isolation 
-		level with the <see cref="BeginTransaction()"/> method, use the overload that
takes the <I>iso</I> parameter.
+		level with the <see cref="BeginTransaction()"/> method, use the overload that
takes the <I>iso</I> parameter.  Also
+    note that any attempt to begin a transaction while a transaction is in progress will
throw an exception on MySQL 4.1 and higher.
+    On MySQL 4.0, an exception will not be thrown because servers 4.0 and earlier did not
report their transacation status.
 		</note></para>
 	</remarks>
 	<example>

Thread
Connector/NET commit: r514 - in trunk: . TestSuite mysqlclient/core mysqlclient/core/docsrburnett29 Dec