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

  956 Reggie Burnett	2011-02-18 [merge]
      merged

    modified:
      MySql.Data/Provider/Source/Connection.cs
      MySql.Data/Tests/Source/Transactions.cs
=== modified file 'MySql.Data/Provider/Source/Connection.cs'
=== modified file 'MySql.Data/Provider/Source/Connection.cs'
--- a/MySql.Data/Provider/Source/Connection.cs	2010-08-18 19:52:04 +0000
+++ b/MySql.Data/Provider/Source/Connection.cs	2011-02-18 15:26:03 +0000
@@ -681,6 +681,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:52:04 +0000
+++ b/MySql.Data/Tests/Source/Transactions.cs	2011-02-18 15:26:03 +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 

No bundle (reason: revision is a merge (you can force generation of a bundle with env var BZR_FORCE_BUNDLE=1)).
Thread
bzr commit into connector-net-trunk branch (reggie.burnett:956) Reggie Burnett18 Feb