MySQL Lists are EOL. Please join:

List:Commits« Previous MessageNext Message »
From:rburnett Date:May 19 2006 4:35pm
Subject:Connector/NET commit: r240 - in branches/1.0: . TestSuite mysqlclient mysqlclient/Types
View as plain text  
Modified:
   branches/1.0/CHANGES
   branches/1.0/TestSuite/StoredProcedure.cs
   branches/1.0/mysqlclient/StoredProcedure.cs
   branches/1.0/mysqlclient/Types/MySqlUInt32.cs
Log:
Bug #19515 DiscoverParameters fails on numeric datatype

We were not handling numeric as a synonym of decimal.  

Modified: branches/1.0/CHANGES
===================================================================
--- branches/1.0/CHANGES	2006-05-19 15:58:50 UTC (rev 239)
+++ branches/1.0/CHANGES	2006-05-19 16:35:21 UTC (rev 240)
@@ -8,7 +8,8 @@
     Bug #19481 Where clause with datetime throws exception [any warning causes the exception] [fixed]
     Bug #15077 Error MySqlCommandBuilder.DeriveParameters for sp without parameters. [fixed]
     Bug #16934 Unsigned values > 2^63 (UInt64) cannot be used in prepared statements
-    
+	Bug #19515 DiscoverParameters fails on numeric datatype [fixed]
+	
 x-xx-05 - Version 1.0.7
 
     Bugs fixed or addressed

Modified: branches/1.0/TestSuite/StoredProcedure.cs
===================================================================
--- branches/1.0/TestSuite/StoredProcedure.cs	2006-05-19 15:58:50 UTC (rev 239)
+++ branches/1.0/TestSuite/StoredProcedure.cs	2006-05-19 16:35:21 UTC (rev 240)
@@ -474,6 +474,7 @@
 		/// <summary>
 		/// Bug #13632  	the MySQLCommandBuilder.deriveparameters has not been updated for MySQL 5
         /// Bug #15077  	Error MySqlCommandBuilder.DeriveParameters for sp without parameters.
+        /// Bug #19515  	DiscoverParameters fails on numeric datatype
 		/// </summary>
 		[Category("5.0")]
 		[Test]
@@ -488,14 +489,15 @@
 
 			execSQL("CREATE PROCEDURE spTest(IN \r\nvalin DECIMAL(10,2), " +
 				"\nIN val2 INT, INOUT val3 FLOAT, OUT val4 DOUBLE, INOUT val5 BIT, " +
-				"val6 VARCHAR(155), val7 SET('a','b'), val8 CHAR) BEGIN SELECT 1; END");
+				"val6 VARCHAR(155), val7 SET('a','b'), val8 CHAR, val9 NUMERIC(10,2)) " +
+                "BEGIN SELECT 1; END");
 
 			MySqlCommand cmd = new MySqlCommand("spTest", conn);
 			cmd.CommandType = CommandType.StoredProcedure;
 			MySqlDataAdapter da = new MySqlDataAdapter(cmd);
 			MySqlCommandBuilder.DeriveParameters(cmd);
 
-			Assert.AreEqual(8, cmd.Parameters.Count);
+			Assert.AreEqual(9, cmd.Parameters.Count);
 			Assert.AreEqual("valin", cmd.Parameters[0].ParameterName);
 			Assert.AreEqual(ParameterDirection.Input, cmd.Parameters[0].Direction);
 			Assert.AreEqual(MySqlDbType.NewDecimal, cmd.Parameters[0].MySqlDbType);
@@ -528,6 +530,10 @@
 			Assert.AreEqual(ParameterDirection.Input, cmd.Parameters[7].Direction);
 			Assert.AreEqual(MySqlDbType.Char, cmd.Parameters[7].MySqlDbType);
 
+            Assert.AreEqual("val9", cmd.Parameters[8].ParameterName);
+            Assert.AreEqual(ParameterDirection.Input, cmd.Parameters[8].Direction);
+            Assert.AreEqual(MySqlDbType.NewDecimal, cmd.Parameters[8].MySqlDbType);
+
             execSQL("DROP PROCEDURE spTest");
             execSQL("CREATE PROCEDURE spTest() BEGIN END");
             cmd.CommandText = "spTest";
@@ -710,6 +716,37 @@
 			}
 		}
 
-	
+        [Test]
+        [Category("5.0")]
+        public void ReturningEmptyResultSet()
+        {
+            execSQL("DROP PROCEDURE IF EXISTS spTest");
+            execSQL("DROP TABLE IF EXISTS test1");
+            execSQL("DROP TABLE IF EXISTS test2");
+            execSQL("CREATE TABLE test1 (id int AUTO_INCREMENT NOT NULL, " +
+                "Name VARCHAR(100) NOT NULL, PRIMARY KEY(id))");
+            execSQL("CREATE TABLE test2 (id int AUTO_INCREMENT NOT NULL, " +
+                "id1 INT NOT NULL, id2 INT NOT NULL, PRIMARY KEY(id))");
+            
+            execSQL("INSERT INTO test1 (Id, Name) VALUES (1, 'Item1')");
+            execSQL("INSERT INTO test1 (Id, Name) VALUES (2, 'Item2')");
+            execSQL("INSERT INTO test2 (Id, Id1, Id2) VALUES (1, 1, 1)");
+            execSQL("INSERT INTO test2 (Id, Id1, Id2) VALUES (2, 2, 1)");
+
+            execSQL("CREATE PROCEDURE spTest(Name VARCHAR(100), OUT Table1Id INT) " +
+                "BEGIN SELECT t1.Id INTO Table1Id FROM test1 t1 WHERE t1.Name LIKE Name; " +
+                "SELECT t3.Id2 FROM test2 t3 WHERE t3.Id1 = Table1Id; END");
+
+            MySqlCommand cmd = conn.CreateCommand();
+            cmd.CommandType = CommandType.StoredProcedure;
+            cmd.CommandText = "spTest";
+            cmd.Parameters.Add("Name", "Item3");
+            cmd.Parameters.Add("Table1Id", MySqlDbType.Int32);
+            cmd.Parameters["Table1Id"].Direction = ParameterDirection.Output;
+
+            DataSet ds = new DataSet();
+            MySqlDataAdapter da = new MySqlDataAdapter(cmd);
+            da.Fill(ds);
+        }
 	}
 }

Modified: branches/1.0/mysqlclient/StoredProcedure.cs
===================================================================
--- branches/1.0/mysqlclient/StoredProcedure.cs	2006-05-19 15:58:50 UTC (rev 239)
+++ branches/1.0/mysqlclient/StoredProcedure.cs	2006-05-19 16:35:21 UTC (rev 240)
@@ -301,6 +301,7 @@
 				case "varchar": return MySqlDbType.VarChar;
 				case "date": return MySqlDbType.Date;
 				case "datetime": return MySqlDbType.Datetime;
+                case "numeric":
 				case "decimal": 
 				case "dec":
 				case "fixed":

Modified: branches/1.0/mysqlclient/Types/MySqlUInt32.cs
===================================================================
--- branches/1.0/mysqlclient/Types/MySqlUInt32.cs	2006-05-19 15:58:50 UTC (rev 239)
+++ branches/1.0/mysqlclient/Types/MySqlUInt32.cs	2006-05-19 16:35:21 UTC (rev 240)
@@ -1,23 +1,23 @@
-// Copyright (C) 2004-2005 MySQL AB
-//
-// This program is free software; you can redistribute it and/or modify
-// it under the terms of the GNU General Public License version 2 as published by
-// the Free Software Foundation
-//
-// There are special exceptions to the terms and conditions of the GPL 
-// as it is applied to this software. View the full text of the 
-// exception in file EXCEPTIONS in the directory of this software 
-// distribution.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA 
-
+// Copyright (C) 2004-2006 MySQL AB
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License version 2 as published by
+// the Free Software Foundation
+//
+// There are special exceptions to the terms and conditions of the GPL 
+// as it is applied to this software. View the full text of the 
+// exception in file EXCEPTIONS in the directory of this software 
+// distribution.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA 
+
 using System;
 using System.Data;
 using MySql.Data.MySqlClient;

Thread
Connector/NET commit: r240 - in branches/1.0: . TestSuite mysqlclient mysqlclient/Typesrburnett19 May