MySQL Lists are EOL. Please join:

List:Commits« Previous MessageNext Message »
From:rburnett Date:December 3 2008 7:31pm
Subject:Connector/NET commit: r1469 - in branches/5.2: . MySql.Data/Provider/Source MySql.Data/Tests/Source
View as plain text  
Modified:
   branches/5.2/CHANGES
   branches/5.2/MySql.Data/Provider/Source/ISSchemaProvider.cs
   branches/5.2/MySql.Data/Tests/Source/StoredProcedure.cs
Log:
- fixed sproc parameter parsing so that a space between the type and size spec would not cause a problem (bug #41034)


Modified: branches/5.2/CHANGES
===================================================================
--- branches/5.2/CHANGES	2008-12-03 17:31:47 UTC (rev 1468)
+++ branches/5.2/CHANGES	2008-12-03 19:31:54 UTC (rev 1469)
@@ -3,6 +3,8 @@
   on the routine (bug #40139)
 - fixed problem with datetime formatting that causes an extra space to be included between the
   date and time when sent to the server (bug #41021)
+- fixed sproc parameter parsing so that a space between the type and size spec would not cause a problem
+  (bug #41034)
       
 Version 5.2.5 - 11/14/2008
 - fixed problem with package registration that kept the DDEX provider from working (bug #40726)

Modified: branches/5.2/MySql.Data/Provider/Source/ISSchemaProvider.cs
===================================================================
--- branches/5.2/MySql.Data/Provider/Source/ISSchemaProvider.cs	2008-12-03 17:31:47 UTC (rev 1468)
+++ branches/5.2/MySql.Data/Provider/Source/ISSchemaProvider.cs	2008-12-03 19:31:54 UTC (rev 1469)
@@ -518,12 +518,26 @@
             string type = row["DATA_TYPE"].ToString();
 
             string token = tokenizer.NextToken();
-            if (tokenizer.IsSize)
+            if (tokenizer.IsSize || token == "(")
             {
+                string oldToken = token;
+                if (token == "(")
+                {
+                    token = String.Empty;
+                    string newTok = tokenizer.NextToken();
+                    while (newTok != ")")
+                    {
+                        token += newTok;
+                        newTok = tokenizer.NextToken();
+                    }
+                }
                 dtd.AppendFormat(CultureInfo.InvariantCulture, "({0})", token);
                 if (type != "ENUM" && type != "SET")
                     ParseDataTypeSize(row, token);
-                token = tokenizer.NextToken();
+                if (oldToken != "(")
+                    token = tokenizer.NextToken();
+                else
+                    token = ")";
             }
             else
                 dtd.Append(GetDataTypeDefaults(type, row));

Modified: branches/5.2/MySql.Data/Tests/Source/StoredProcedure.cs
===================================================================
--- branches/5.2/MySql.Data/Tests/Source/StoredProcedure.cs	2008-12-03 17:31:47 UTC (rev 1468)
+++ branches/5.2/MySql.Data/Tests/Source/StoredProcedure.cs	2008-12-03 19:31:54 UTC (rev 1469)
@@ -1499,5 +1499,29 @@
                 suExecSQL("DROP USER abc");
             }
         }
+
+        /// <summary>
+        /// Bug #41034 .net parameter not found in the collection
+        /// </summary>
+        [Test]
+        public void SPWithSpaceInParameterType()
+        {
+            if (version < new Version(5, 0)) return;
+
+            execSQL("CREATE PROCEDURE spTest(myparam decimal  (8,2)) BEGIN SELECT 1; END");
+
+            string connStr = GetConnectionString(true);
+            connStr = connStr.Replace("use procedure bodies=false", "");
+            using (MySqlConnection c = new MySqlConnection(connStr))
+            {
+                c.Open();
+
+                MySqlCommand cmd = new MySqlCommand("spTest", c);
+                cmd.Parameters.Add("@myparam", MySqlDbType.Decimal).Value = 20;
+                cmd.CommandType = CommandType.StoredProcedure;
+                object o = cmd.ExecuteScalar();
+                Assert.AreEqual(1, o);
+            }
+        }
     }
 }

Thread
Connector/NET commit: r1469 - in branches/5.2: . MySql.Data/Provider/Source MySql.Data/Tests/Sourcerburnett3 Dec