From: Date: December 29 2006 4:31pm
Subject: Connector/NET commit: r514 - in trunk: . TestSuite mysqlclient/core mysqlclient/core/docs
List-Archive: http://lists.mysql.com/commits/17464
X-Bug: 22400
Message-Id: <200612291531.kBTFVtS6008486@bk-internal.mysql.com>
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
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 @@
///
/// Bug #22400 Nested transactions
///
- [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 @@
///
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 @@
You must explicitly commit or roll back the transaction using the or
method.
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.
+ 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.