#At file:///C:/Users/Reggie/work/connector-net/6.0/ based on revid:reggie.burnett@stripped
865 Reggie Burnett 2011-03-09
- added batching support for updates and deletes (bug #59616, Oracle bug #11850286)
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 17:54:43 +0000
+++ b/CHANGES 2011-03-09 18:00:01 +0000
@@ -29,6 +29,7 @@
- fixed calculation of precision and scale for decimal columns
(MySQL bug #59989, Oracle bug #11776346)
- small but important improvements in EF sql generation
+- added batching support for updates and deletes (bug #59616)
Version 6.0.7
- 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 16:45:56 +0000
+++ b/MySql.Data/Provider/Source/command.cs 2011-03-09 18:00:01 +0000
@@ -825,6 +825,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 17:55:08 +0000
+++ b/MySql.Data/Tests/Source/CommandTests.cs 2011-03-09 18:00:01 +0000
@@ -23,6 +23,7 @@
using MySql.Data.MySqlClient;
using NUnit.Framework;
using System.Threading;
+using System.Diagnostics;
namespace MySql.Data.MySqlClient.Tests
{
@@ -490,7 +491,41 @@
catch (MySqlException ex)
{
}
-
+ }
+
+ /// <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')");
+
+ Trace.Listeners.Clear();
+ GenericListener listener = new GenericListener();
+ Trace.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("UPDATE"));
}
}
Attachment: [text/bzr-bundle] bzr/reggie.burnett@oracle.com-20110309180001-em5zpw40eadq9igk.bundle
| Thread |
|---|
| • bzr commit into connector-net-6.0 branch (reggie.burnett:865) Bug#59616Bug#11850286 | Reggie Burnett | 9 Mar |