MySQL Lists are EOL. Please join:

List:Commits« Previous MessageNext Message »
From:Reggie Burnett Date:July 30 2009 1:53am
Subject:bzr push into connector-net-6.1 branch (reggie.burnett:715 to 716)
View as plain text  
  716 Reggie Burnett	2009-07-29 [merge]
      merged

    modified:
      CHANGES
      MySql.Data/Provider/Source/MySqlScript.cs
      MySql.Data/Provider/Source/StoredProcedure.cs
      MySql.Data/Tests/Source/StoredProcedure.cs
  715 Reggie Burnett	2009-07-29 [merge]
      merged

    modified:
      CHANGES
      MySql.Data/Provider/Source/SchemaProvider.cs
      MySql.Data/Tests/Source/GetSchemaTests.cs
=== modified file 'CHANGES'
=== modified file 'CHANGES'
--- a/CHANGES	2009-07-29 22:14:26 +0000
+++ b/CHANGES	2009-07-30 01:51:52 +0000
@@ -71,6 +71,8 @@
     (bug#46205)
 - fixed MySqlScript class so that it respects delimiter statements (bug #46429)
 - fixed "column" schema collection so that it will return set and enum datatypes correctly (bug #46270)
+- fixed bug calling procedures that the user has body access to with parameters that are
+  out of order while using the 'use procedure bodies=false' option would fail (bug #46213)
 
 Version 5.2.7  7/13/09
 - fixed procedure parameters collection so that an exception is thrown if we can't get the 

=== modified file 'MySql.Data/Provider/Source/MySqlScript.cs'
--- a/MySql.Data/Provider/Source/MySqlScript.cs	2009-07-29 21:34:56 +0000
+++ b/MySql.Data/Provider/Source/MySqlScript.cs	2009-07-30 01:48:17 +0000
@@ -266,15 +266,15 @@
                     if (token.ToLowerInvariant() == "delimiter")
                     {
                         currentDelimiter = tokenizer.NextToken();
-                        startPos = tokenizer.Index;
+                        startPos = tokenizer.StopIndex;
                     }
                     else
                     {
                         int delimiterPos = token.IndexOf(currentDelimiter);
                         if (delimiterPos != -1)
                         {
-                            int endPos = tokenizer.Index - token.Length + delimiterPos;
-                            if (tokenizer.Index == query.Length - 1)
+                            int endPos = tokenizer.StopIndex - token.Length + delimiterPos;
+                            if (tokenizer.StopIndex == query.Length - 1)
                                 endPos++;
                             string currentQuery = query.Substring(startPos, endPos - startPos);
                             ScriptStatement statement = new ScriptStatement();

=== modified file 'MySql.Data/Provider/Source/StoredProcedure.cs'
--- a/MySql.Data/Provider/Source/StoredProcedure.cs	2009-07-28 20:40:35 +0000
+++ b/MySql.Data/Provider/Source/StoredProcedure.cs	2009-07-30 01:51:52 +0000
@@ -67,8 +67,16 @@
             //if (Connection.Settings.UseProcedureBodies)
             DataSet ds = Connection.ProcedureCache.GetProcedure(Connection, procName);
 
-            // if we got both proc and parameter data then just return
-            if (ds.Tables.Count == 2) return ds;
+            if(ds.Tables.Count == 2)
+            {
+                // if we got our parameters and our user says it is ok to use proc bodies
+                // then just return them
+                if (Connection.Settings.UseProcedureBodies) return ds;
+
+                // we got the parameters, but ignore them.
+                if(ds.Tables.Contains("Procedure Parameters"))
+                    ds.Tables.Remove("Procedure Parameters");
+            }
 
             // we were not able to retrieve parameter data so we have to make do by
             // adding the parameters from the command object to our table

=== modified file 'MySql.Data/Tests/Source/StoredProcedure.cs'
--- a/MySql.Data/Tests/Source/StoredProcedure.cs	2009-07-28 20:40:35 +0000
+++ b/MySql.Data/Tests/Source/StoredProcedure.cs	2009-07-30 01:51:52 +0000
@@ -1227,17 +1227,24 @@
             Assert.AreEqual(1, o);
         }
 
-        [Test]
-        public void ParametersInReverseOrder()
+        private void ParametersInReverseOrderInternal(bool isOwner)
         {
             if (Version.Major < 5) return;
 
-            rootConn.ChangeDatabase(database1);
-            suExecSQL(@"CREATE PROCEDURE spTest(IN p_1 VARCHAR(5), IN p_2 VARCHAR(5))
-                        BEGIN SELECT p_1 AS P1, p_2 AS P2; END");
-            rootConn.ChangeDatabase(database0);
+            string sql = @"CREATE PROCEDURE spTest(IN p_1 VARCHAR(5), IN p_2 VARCHAR(5))
+                        BEGIN SELECT p_1 AS P1, p_2 AS P2; END";
+            string spName = "spTest";
+            if (!isOwner)
+            {
+                rootConn.ChangeDatabase(database1);
+                suExecSQL(sql);
+                rootConn.ChangeDatabase(database0);
+                spName = database1 + ".spTest";
+            }
+            else
+                execSQL(sql);
 
-            MySqlCommand cmd = new MySqlCommand(database1 + ".spTest", conn);
+            MySqlCommand cmd = new MySqlCommand(spName, conn);
             cmd.CommandType = CommandType.StoredProcedure;
             cmd.CommandTimeout = 0;
             cmd.Parameters.AddWithValue("?p_2", ("World"));
@@ -1263,6 +1270,18 @@
         }
 
         [Test]
+        public void ParametersInReverseOrderNotOwner()
+        {
+            ParametersInReverseOrderInternal(false);
+        }
+
+        [Test]
+        public void ParametersInReverseOrderOwner()
+        {
+            ParametersInReverseOrderInternal(true);
+        }
+
+        [Test]
         public void DeriveParameters()
         {
             if (Version < new Version(5, 0)) return;


Attachment: [text/bzr-bundle] bzr/reggie.burnett@sun.com-20090730015152-sr4kicywp6j36c2r.bundle
Thread
bzr push into connector-net-6.1 branch (reggie.burnett:715 to 716)Reggie Burnett30 Jul