List:Commits« Previous MessageNext Message »
From:Reggie Burnett Date:February 18 2011 3:25pm
Subject:bzr commit into connector-net-6.2 branch (reggie.burnett:920) Bug#59346
Bug#11766272
View as plain text  
#At file:///C:/Users/Reggie/work/connector-net/6.2/ based on revid:reggie.burnett@stripped

  920 Reggie Burnett	2011-02-18
      - fixed NullReferenceException when a timeout occurred inside a TransactionScope
        (MySQL bug #59346, Oracle bug #11766272)

    modified:
      CHANGES
      MySql.Data/Provider/Source/Connection.cs
      MySql.Data/Tests/Source/Transactions.cs
=== modified file 'CHANGES'
=== modified file 'CHANGES'
--- a/CHANGES	2011-02-15 21:06:20 +0000
+++ b/CHANGES	2011-02-18 15:25:18 +0000
@@ -29,6 +29,8 @@
   of a keyword (MySQL bug #59835, Oracle bug #11766671)
 - fixed calculation of precision and scale for decimal columns
   (MySQL bug #59989, Oracle bug #11776346)
+- fixed NullReferenceException when a timeout occurred inside a TransactionScope
+  (MySQL bug #59346, Oracle bug #11766272)
 
 Version 6.2.4
 - Fix authorization popup after modifying stored procedure in VS (Bug #44715)

=== modified file 'MySql.Data/Provider/Source/Connection.cs'
--- a/MySql.Data/Provider/Source/Connection.cs	2010-08-18 19:48:34 +0000
+++ b/MySql.Data/Provider/Source/Connection.cs	2011-02-18 15:25:18 +0000
@@ -688,6 +688,7 @@
             MySqlConnectionStringBuilder cb = new MySqlConnectionStringBuilder(
                 Settings.ConnectionString);
             cb.Pooling = false;
+            cb.AutoEnlist = false;
             cb.ConnectionTimeout = (uint) timeout;
           
             using(MySqlConnection c = new MySqlConnection(cb.ConnectionString))

=== modified file 'MySql.Data/Tests/Source/Transactions.cs'
--- a/MySql.Data/Tests/Source/Transactions.cs	2010-08-18 19:48:34 +0000
+++ b/MySql.Data/Tests/Source/Transactions.cs	2011-02-18 15:25:18 +0000
@@ -176,6 +176,66 @@
             KillConnection(connection);
         }
 
+        /// <summary>
+        /// NullReferenceException thrown on TransactionScope dispose
+        /// </summary>
+        [Test]
+        public void LockedTable()
+        {
+            string connStr = GetConnectionString(true);
+
+            connStr = String.Format(@"Use Affected Rows=true;allow user variables=yes;Server=localhost;Port=3306;
+            Database={0};Uid=root;Connect Timeout=35;default command timeout=90;charset=utf8", database0);
+
+
+            execSQL(@"CREATE TABLE `t1` (
+                `Key` int(10) unsigned NOT NULL auto_increment,
+                `Val` varchar(100) NOT NULL,
+                `Val2` varchar(100) NOT NULL default '',
+                PRIMARY KEY  (`Key`)
+                ) ENGINE=InnoDB AUTO_INCREMENT=13 DEFAULT CHARSET=latin1");
+            execSQL(@"CREATE TABLE `t2` (
+                `Key` int(10) unsigned NOT NULL auto_increment,
+                `Val` varchar(100) NOT NULL,
+                PRIMARY KEY  (`Key`)
+                ) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=latin1");
+
+            execSQL("lock tables t2 read");
+
+            using (TransactionScope scope = new TransactionScope())
+            {
+                using (MySqlConnection conn = new MySqlConnection(connStr))
+                using (MySqlCommand cmd = conn.CreateCommand())
+                {
+                    conn.Open();
+                    cmd.CommandText = @"insert into t1 (Val,Val2) values (?value1, ?value2)"; ;
+                    cmd.CommandTimeout = 5;
+                    cmd.Parameters.AddWithValue("?value1", new Random().Next());
+                    cmd.Parameters.AddWithValue("?value2", new Random().Next());
+                    cmd.ExecuteNonQuery();
+                }
+
+                using (MySqlConnection conn = new MySqlConnection(connStr))
+                using (MySqlCommand cmd = conn.CreateCommand())
+                {
+                    conn.Open();
+                    cmd.CommandText = @"insert into t2 (Val) values (?value)";
+                    cmd.CommandTimeout = 5;
+                    cmd.Parameters.AddWithValue("?value", new Random().Next());
+                    try
+                    {
+                        cmd.ExecuteNonQuery();
+                    }
+                    catch (MySqlException ex)
+                    {
+                        Assert.IsTrue(ex.InnerException is TimeoutException);
+                    }
+                }
+
+                scope.Complete();
+            }
+        }
+
 
         /// <summary>
         /// Bug #22042 mysql-connector-net-5.0.0-alpha BeginTransaction 


Attachment: [text/bzr-bundle] bzr/reggie.burnett@oracle.com-20110218152518-edjizlzlh6vbypoa.bundle
Thread
bzr commit into connector-net-6.2 branch (reggie.burnett:920) Bug#59346Bug#11766272Reggie Burnett18 Feb