#At file:///C:/Users/Reggie/work/connector-net/6.0/ based on revid:reggie.burnett@stripped
858 Reggie Burnett 2011-02-14
- fixed exection of command ";" to throw a query was empty exception instead of IndexOutOfRangeException
(MySQL bug #59537, Oracle bug #11766433)
modified:
CHANGES
MySql.Data/Provider/Source/command.cs
MySql.Data/Tests/Source/CommandTests.cs
=== modified file 'CHANGES'
=== modified file 'CHANGES'
--- a/CHANGES 2011-01-06 16:00:10 +0000
+++ b/CHANGES 2011-02-14 16:45:56 +0000
@@ -20,6 +20,8 @@
- fixed unnecessary string code in MySqlTokenizer (bug #58757)
- fixed MembershipProvider to properly set a hash key when using a keyed hash alogrithm (bug #58906)
- small code adjustment to make sure our object enumeration works with MySQL 5.5
+- fixed exection of command ";" to throw a query was empty exception instead of IndexOutOfRangeException
+ (MySQL bug #59537, Oracle bug #11766433)
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 2010-10-11 18:27:43 +0000
+++ b/MySql.Data/Provider/Source/command.cs 2011-02-14 16:45:56 +0000
@@ -383,11 +383,11 @@
lastInsertedId = -1;
CheckState();
- if (cmdText == null ||
- cmdText.Trim().Length == 0)
+ cmdText = cmdText.Trim();
+ if (String.IsNullOrEmpty(cmdText))
throw new InvalidOperationException(Resources.CommandTextNotInitialized);
- string sql = TrimSemicolons(cmdText);
+ string sql = cmdText.Trim(';');
// now we check to see if we are executing a query that is buggy
// in 4.1
@@ -558,18 +558,6 @@
internal delegate void AsyncDelegate(int type, CommandBehavior behavior);
internal Exception thrownException;
- private static string TrimSemicolons(string sql)
- {
- int start = 0;
- while (sql[start] == ';')
- start++;
-
- int end = sql.Length - 1;
- while (sql[end] == ';')
- end--;
- return sql.Substring(start, end-start+1);
- }
-
internal void AsyncExecuteWrapper(int type, CommandBehavior behavior)
{
thrownException = null;
=== modified file 'MySql.Data/Tests/Source/CommandTests.cs'
--- a/MySql.Data/Tests/Source/CommandTests.cs 2010-12-14 15:17:51 +0000
+++ b/MySql.Data/Tests/Source/CommandTests.cs 2011-02-14 16:45:56 +0000
@@ -465,6 +465,33 @@
Assert.IsTrue(c.State == ConnectionState.Closed);
}
}
+
+ /// <summary>
+ /// Bug #59537 Different behavior from console and
+ /// </summary>
+ [Test]
+ public void EmptyOrJustSemiCommand()
+ {
+ MySqlCommand cmd = new MySqlCommand("", conn);
+ try
+ {
+ cmd.ExecuteNonQuery();
+ Assert.Fail();
+ }
+ catch (InvalidOperationException ex)
+ {
+ }
+
+ cmd.CommandText = ";";
+ try
+ {
+ cmd.ExecuteNonQuery();
+ }
+ catch (MySqlException ex)
+ {
+ }
+
+ }
}
Attachment: [text/bzr-bundle] bzr/reggie.burnett@oracle.com-20110214164556-t2cwkfov5klu3gwt.bundle
| Thread |
|---|
| • bzr commit into connector-net-6.0 branch (reggie.burnett:858) Bug#59537Bug#11766433 | Reggie Burnett | 14 Feb |