MySQL Lists are EOL. Please join:

List:Commits« Previous MessageNext Message »
From:Reggie Burnett Date:July 30 2009 1:54am
Subject:bzr push into connector-net-5.2 branch (reggie.burnett:699 to 700)
Bug#46213
View as plain text  
  700 Reggie Burnett	2009-07-29
      - 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)
      
      The problem was that the code that attempted to pull the parameters would notice that it could pull the actual parameter order and would use that instead of what the user gave.  Sometimes users use the 'use procedure bodies=false' option and intentionally give parameters out of order

    modified:
      CHANGES
      MySql.Data/Provider/Source/StoredProcedure.cs
      MySql.Data/Tests/Source/StoredProcedure.cs
  699 Reggie Burnett	2009-07-29
      fixed "column" schema collection so that it will return set and enum datatypes correctly (bug #46270)

    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:09:42 +0000
+++ b/CHANGES	2009-07-30 01:05:10 +0000
@@ -3,6 +3,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/StoredProcedure.cs'
--- a/MySql.Data/Provider/Source/StoredProcedure.cs	2009-07-13 02:27:28 +0000
+++ b/MySql.Data/Provider/Source/StoredProcedure.cs	2009-07-30 01:05:10 +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-13 02:27:28 +0000
+++ b/MySql.Data/Tests/Source/StoredProcedure.cs	2009-07-30 01:05:10 +0000
@@ -58,7 +58,7 @@
         public override void FixtureSetup()
         {
             pooling = false;
-            csAdditions = ";procedure cache size=0;logging=true;";
+            csAdditions = ";procedure cache size=0;";
             base.FixtureSetup();
         }
 
@@ -1450,7 +1450,6 @@
         {
             if (version < new Version(5, 0)) return;
 
-            
             execSQL("CREATE PROCEDURE spTest() BEGIN SELECT 1; END");
             execSQL("CREATE PROCEDURE spTest2() BEGIN SELECT 1; END");
             suExecSQL("CREATE USER abc IDENTIFIED BY 'abc'");
@@ -1464,6 +1463,7 @@
                 using (MySqlConnection c = new MySqlConnection(connStr))
                 {
                     c.Open();
+
                     MySqlCommand cmd = new MySqlCommand("spTest", c);
                     cmd.CommandType = CommandType.StoredProcedure;
                     try
@@ -1517,17 +1517,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"));
@@ -1551,5 +1558,17 @@
                 Assert.AreEqual("World", dt.Rows[0]["P2"]);
             }
         }
+
+        [Test]
+        public void ParametersInReverseOrderNotOwner()
+        {
+            ParametersInReverseOrderInternal(false);
+        }
+
+        [Test]
+        public void ParametersInReverseOrderOwner()
+        {
+            ParametersInReverseOrderInternal(true);
+        }
     }
 }


Attachment: [text/bzr-bundle] bzr/reggie.burnett@sun.com-20090730010510-030h93f1yjgea5q2.bundle
Thread
bzr push into connector-net-5.2 branch (reggie.burnett:699 to 700)Bug#46213Reggie Burnett30 Jul