#At file:///C:/Users/Reggie/work/connector-net/6.3/ based on revid:reggie.burnett@stripped
961 Reggie Burnett 2011-02-14 [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-01-06 16:33:06 +0000
+++ b/CHANGES 2011-02-14 17:19:36 +0000
@@ -1,5 +1,7 @@
Version 6.3.7
- IPv6 connections are now supported
+- fixed exection of command ";" to throw a query was empty exception instead of IndexOutOfRangeException
+ (MySQL bug #59537, Oracle bug #11766433)
Version 6.3.6
- Fixed TracingDriver so that it normalizes long queries before truncation so we don't get exceptions
=== modified file 'MySql.Data/Provider/Source/command.cs'
--- a/MySql.Data/Provider/Source/command.cs 2010-10-11 18:30:02 +0000
+++ b/MySql.Data/Provider/Source/command.cs 2011-02-14 17:19:36 +0000
@@ -410,11 +410,11 @@
commandTimer = new CommandTimer(connection, CommandTimeout);
lastInsertedId = -1;
- 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(';');
if (CommandType == CommandType.TableDirect)
sql = "SELECT * FROM " + sql;
@@ -580,18 +580,6 @@
internal AsyncDelegate caller = null;
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 object 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:25:24 +0000
+++ b/MySql.Data/Tests/Source/CommandTests.cs 2011-02-14 17:19:36 +0000
@@ -487,6 +487,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)
+ {
+ }
+
+ cmd.CommandText = ";";
+ try
+ {
+ cmd.ExecuteNonQuery();
+ }
+ catch (MySqlException)
+ {
+ }
+
+ }
}
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:961) | Reggie Burnett | 14 Feb |