From: Date: December 29 2006 4:37pm Subject: Connector/NET commit: r515 - in branches/1.0: . TestSuite mysqlclient mysqlclient/docs List-Archive: http://lists.mysql.com/commits/17465 X-Bug: 22400 Message-Id: <200612291537.kBTFbsbl008710@bk-internal.mysql.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Modified: branches/1.0/CHANGES branches/1.0/TestSuite/SimpleTransactions.cs branches/1.0/mysqlclient/Connection.cs branches/1.0/mysqlclient/docs/MySqlConnection.xml branches/1.0/mysqlclient/transaction.cs 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: branches/1.0/CHANGES =================================================================== --- branches/1.0/CHANGES 2006-12-29 15:31:54 UTC (rev 514) +++ branches/1.0/CHANGES 2006-12-29 15:37:53 UTC (rev 515) @@ -16,6 +16,7 @@ are required. This will be fixed when the server exposes procedure parameters via information schema.] Bug #25013 Return Value parameter not found + Bug #22400 Nested transactions Other changes ------------- Modified: branches/1.0/TestSuite/SimpleTransactions.cs =================================================================== --- branches/1.0/TestSuite/SimpleTransactions.cs 2006-12-29 15:31:54 UTC (rev 514) +++ branches/1.0/TestSuite/SimpleTransactions.cs 2006-12-29 15:37:53 UTC (rev 515) @@ -87,10 +87,10 @@ try { MySqlTransaction t2 = conn.BeginTransaction(); - t2.Rollback(); - Assert.Fail("Exception should have been thrown"); + Assert.Fail("Exception should have been thrown"); + t2.Rollback(); } - catch (NotSupportedException) + catch (InvalidOperationException) { } catch (Exception ex) Modified: branches/1.0/mysqlclient/Connection.cs =================================================================== --- branches/1.0/mysqlclient/Connection.cs 2006-12-29 15:31:54 UTC (rev 514) +++ branches/1.0/mysqlclient/Connection.cs 2006-12-29 15:37:53 UTC (rev 515) @@ -40,7 +40,6 @@ private MySqlConnectionString settings; private bool hasBeenOpen; private ProcedureCache procedureCache; - internal MySqlTransaction activeLegacyTransaction; /// public event StateChangeEventHandler StateChange; @@ -214,8 +213,9 @@ if (state != ConnectionState.Open) throw new InvalidOperationException(Resources.ConnectionNotOpen); - if (activeLegacyTransaction != null) - throw new NotSupportedException(Resources.NoNestedTransactions); + // First check to see if we are in a current transaction + if ((driver.ServerStatus & ServerStatusFlags.InTransaction) != 0) + throw new InvalidOperationException(Resources.NoNestedTransactions); MySqlTransaction t = new MySqlTransaction(this, iso); @@ -240,8 +240,6 @@ cmd.CommandText = "BEGIN"; cmd.ExecuteNonQuery(); - - activeLegacyTransaction = t; return t; } @@ -347,7 +345,6 @@ dataReader.Close(); Terminate(); - activeLegacyTransaction = null; } IDbCommand IDbConnection.CreateCommand() Modified: branches/1.0/mysqlclient/docs/MySqlConnection.xml =================================================================== --- branches/1.0/mysqlclient/docs/MySqlConnection.xml 2006-12-29 15:31:54 UTC (rev 514) +++ branches/1.0/mysqlclient/docs/MySqlConnection.xml 2006-12-29 15:37:53 UTC (rev 515) @@ -325,6 +325,8 @@ If you do not specify an isolation level, the default isolation level is used. To specify an isolation level with the method, use the overload that takes the iso 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. @@ -438,6 +440,8 @@ If you do not specify an isolation level, the default isolation level is used. To specify an isolation level with the method, use the overload that takes the iso 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. Modified: branches/1.0/mysqlclient/transaction.cs =================================================================== --- branches/1.0/mysqlclient/transaction.cs 2006-12-29 15:31:54 UTC (rev 514) +++ branches/1.0/mysqlclient/transaction.cs 2006-12-29 15:37:53 UTC (rev 515) @@ -97,10 +97,6 @@ { throw; } - finally - { - conn.activeLegacyTransaction = null; - } } /// @@ -120,10 +116,6 @@ { throw; } - finally - { - conn.activeLegacyTransaction = null; - } } } }