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

  922 Reggie Burnett	2011-03-09 [merge]
      merged

    modified:
      CHANGES
      MySql.Data/Provider/Source/command.cs
      MySql.Data/Tests/Source/CommandTests.cs
=== modified file 'CHANGES'
=== modified file 'CHANGES'
--- a/CHANGES	2011-03-03 18:01:04 +0000
+++ b/CHANGES	2011-03-09 18:18:40 +0000
@@ -32,6 +32,7 @@
 - fixed NullReferenceException when a timeout occurred inside a TransactionScope
   (MySQL bug #59346, Oracle bug #11766272)
 - small but important improvements in EF sql generation
+- added batching support for updates and deletes (bug #59616)
 
 Version 6.2.4
 - Fix authorization popup after modifying stored procedure in VS (Bug #44715)

=== modified file 'MySql.Data/Provider/Source/command.cs'
--- a/MySql.Data/Provider/Source/command.cs	2011-02-14 17:14:23 +0000
+++ b/MySql.Data/Provider/Source/command.cs	2011-03-09 18:18:40 +0000
@@ -882,6 +882,8 @@
                         token = tokenizer.NextToken();
                     }
                 }
+                // Otherwise use the command verbatim
+                else batchableCommandText = CommandText;
             }
 
             return batchableCommandText;

=== modified file 'MySql.Data/Tests/Source/CommandTests.cs'
--- a/MySql.Data/Tests/Source/CommandTests.cs	2011-03-03 18:01:04 +0000
+++ b/MySql.Data/Tests/Source/CommandTests.cs	2011-03-09 18:18:40 +0000
@@ -25,6 +25,7 @@
 using MySql.Data.MySqlClient;
 using NUnit.Framework;
 using System.Threading;
+using System.Diagnostics;
 
 namespace MySql.Data.MySqlClient.Tests
 {
@@ -497,7 +498,42 @@
             catch (MySqlException)
             {
             }
-
+        }
+
+        /// <summary>
+        /// Bug #59616	Only INSERTs are batched
+        /// </summary>
+        [Test]
+        public void BatchUpdatesAndDeletes()
+        {
+            execSQL("CREATE TABLE test (id INT AUTO_INCREMENT PRIMARY KEY, name VARCHAR(20))");
+            execSQL("INSERT INTO test VALUES (1, 'boo'), (2, 'boo'), (3, 'boo')");
+
+            MySqlTrace.Listeners.Clear();
+            MySqlTrace.Switch.Level = SourceLevels.All;
+            GenericListener listener = new GenericListener();
+            MySqlTrace.Listeners.Add(listener);
+
+            string connStr = GetConnectionString(true) + ";logging=true;allow batch=true";
+            using (MySqlConnection c = new MySqlConnection(connStr))
+            {
+                c.Open();
+                MySqlDataAdapter da = new MySqlDataAdapter("SELECT * FROM test", c);
+                MySqlCommandBuilder cb = new MySqlCommandBuilder(da);
+                da.UpdateCommand = cb.GetUpdateCommand();
+                da.UpdateCommand.UpdatedRowSource = UpdateRowSource.None;
+                da.UpdateBatchSize = 100;
+
+                DataTable dt = new DataTable();
+                da.Fill(dt);
+
+                dt.Rows[0]["name"] = "boo2";
+                dt.Rows[1]["name"] = "boo2";
+                dt.Rows[2]["name"] = "boo2";
+                da.Update(dt);
+            }
+
+            Assert.AreEqual(1, listener.Find("Query Opened: UPDATE"));
         }
     }
 

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-6.2 branch (reggie.burnett:922) Reggie Burnett9 Mar