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

  916 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:01:33 +0000
+++ b/CHANGES	2011-02-14 17:14:23 +0000
@@ -21,6 +21,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.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	2010-10-11 18:28:28 +0000
+++ b/MySql.Data/Provider/Source/command.cs	2011-02-14 17:14:23 +0000
@@ -407,11 +407,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;
@@ -602,18 +602,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:22:41 +0000
+++ b/MySql.Data/Tests/Source/CommandTests.cs	2011-02-14 17:14:23 +0000
@@ -472,6 +472,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-6.2 branch (reggie.burnett:916) Reggie Burnett14 Feb