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

  871 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:00:58 +0000
+++ b/CHANGES	2011-02-14 17:11:07 +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.1.5
 - 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:12 +0000
+++ b/MySql.Data/Provider/Source/command.cs	2011-02-14 17:11:07 +0000
@@ -386,11 +386,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
@@ -553,18 +553,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:18:14 +0000
+++ b/MySql.Data/Tests/Source/CommandTests.cs	2011-02-14 17:11:07 +0000
@@ -467,6 +467,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.1 branch (reggie.burnett:871) Reggie Burnett14 Feb