MySQL Lists are EOL. Please join:

List:Commits« Previous MessageNext Message »
From:rburnett Date:September 19 2006 7:32pm
Subject:Connector/NET commit: r349 - in trunk: . TestSuite mysqlclient
View as plain text  
Modified:
   trunk/CHANGES
   trunk/TestSuite/StoredProcedure.cs
   trunk/mysqlclient/StoredProcedure.cs
Log:
Bug #22452 MySql.Data.MySqlClient.MySqlException: 
This bug was fixed earlier but the test case showed a different problem in the stored procedure code so it's listed here again.

Modified: trunk/CHANGES
===================================================================
--- trunk/CHANGES	2006-09-19 18:55:06 UTC (rev 348)
+++ trunk/CHANGES	2006-09-19 19:32:12 UTC (rev 349)
@@ -3,7 +3,8 @@
 	Bug #21521 # Symbols not allowed in column/table names.    
     Bug #21874 MySqlException should derive from DbException         
 	Bug #22042 mysql-connector-net-5.0.0-alpha BeginTransaction
-	 
+	Bug #22452 MySql.Data.MySqlClient.MySqlException: 	 
+	
     Other changes
     -------------
     Implemented simple local transactions

Modified: trunk/TestSuite/StoredProcedure.cs
===================================================================
--- trunk/TestSuite/StoredProcedure.cs	2006-09-19 18:55:06 UTC (rev 348)
+++ trunk/TestSuite/StoredProcedure.cs	2006-09-19 19:32:12 UTC (rev 349)
@@ -22,13 +22,16 @@
 using System.Data;
 using MySql.Data.MySqlClient;
 using NUnit.Framework;
+using System.Threading;
+using System.Globalization;
 
 namespace MySql.Data.MySqlClient.Tests
 {
 	/// <summary>
 	/// Summary description for StoredProcedure.
 	/// </summary>
-	[TestFixture]
+	[Category("5.0")]
+    [TestFixture]
 	public class StoredProcedure : BaseTest
 	{
 		private static string fillError = null;
@@ -874,5 +877,95 @@
                     reader.Close();
             }
         }
+
+        /// <summary>
+        /// Bug #17046 Null pointer access when stored procedure is used 
+        /// </summary>
+        [Test]
+        public void PreparedReader()
+        {
+            execSQL("DROP TABLE IF EXISTS test");
+            execSQL("CREATE TABLE  test (id int(10) unsigned NOT NULL default '0', " +
+                "val int(10) unsigned default NULL, PRIMARY KEY (id)) " +
+                "ENGINE=InnoDB DEFAULT CHARSET=utf8");
+            execSQL("CREATE PROCEDURE spTest (IN pp INTEGER) " +
+                    "select * from test where id > pp ");
+
+            MySqlCommand c = new MySqlCommand("spTest", conn);
+            c.CommandType = CommandType.StoredProcedure;
+            IDataParameter p = c.CreateParameter();
+            p.ParameterName = "pp";
+            p.Value = 10;
+            c.Parameters.Add(p);
+            c.Prepare();
+            MySqlDataReader reader = null;
+            try
+            {
+                reader = c.ExecuteReader();
+                while (reader.Read())
+                {
+
+                }
+            }
+            catch (Exception ex)
+            {
+                Assert.Fail(ex.Message);
+            }
+            finally
+            {
+                if (reader != null)
+                    reader.Close();
+            }
+        }
+
+        [Test]
+        public void UnsignedOutputParameters()
+        {
+            execSQL("DROP TABLE IF EXISTS test");
+            execSQL("CREATE TABLE  test (id INT(10) UNSIGNED AUTO_INCREMENT, PRIMARY KEY (id)) ");
+            execSQL("CREATE PROCEDURE spTest (OUT id BIGINT UNSIGNED) " +
+                    "BEGIN INSERT INTO test VALUES (NULL); SET id=LAST_INSERT_ID(); END");
+
+            MySqlCommand cmd = new MySqlCommand("spTest", conn);
+            cmd.CommandType = CommandType.StoredProcedure;
+            cmd.Parameters.Add("?id", MySqlDbType.UInt64);
+            cmd.Parameters[0].Direction = ParameterDirection.Output;
+            cmd.ExecuteNonQuery();
+
+            object o = cmd.Parameters[0].Value;
+            Assert.IsTrue(o is ulong);
+            Assert.AreEqual(1, o);
+        }
+
+        /// <summary>
+        /// Bug #22452 MySql.Data.MySqlClient.MySqlException: 
+        /// </summary>
+        [Category("5.0")]
+        [Test]
+        public void TurkishStoredProcs()
+        {
+            execSQL("CREATE PROCEDURE spTest(IN p_paramname INT) BEGIN SELECT p_paramname; END");
+            CultureInfo uiCulture = Thread.CurrentThread.CurrentUICulture;
+            CultureInfo culture = Thread.CurrentThread.CurrentCulture;
+            Thread.CurrentThread.CurrentCulture = new CultureInfo("tr-TR");
+            Thread.CurrentThread.CurrentUICulture = new CultureInfo("tr-TR");
+
+            try
+            {
+                MySqlCommand cmd = new MySqlCommand("spTest", conn);
+                cmd.Parameters.Add("p_paramname", 2);
+                cmd.CommandType = CommandType.StoredProcedure;
+                cmd.ExecuteScalar();
+            }
+            catch (Exception ex)
+            {
+                Assert.Fail(ex.Message);
+            }
+            finally
+            {
+                Thread.CurrentThread.CurrentCulture = culture;
+                Thread.CurrentThread.CurrentUICulture = uiCulture;
+            }
+        }
     }
 }

Modified: trunk/mysqlclient/StoredProcedure.cs
===================================================================
--- trunk/mysqlclient/StoredProcedure.cs	2006-09-19 18:55:06 UTC (rev 348)
+++ trunk/mysqlclient/StoredProcedure.cs	2006-09-19 19:32:12 UTC (rev 349)
@@ -69,9 +69,9 @@
             string retParm = GetReturnParameter();
             foreach (DataRow param in parametersTable.Rows)
             {
-                if (param["ordinal_position"].Equals(0)) continue;
-                string mode = (string)param["parameter_mode"];
-                string name = (string)param["parameter_name"];
+                if (param["ORDINAL_POSITION"].Equals(0)) continue;
+                string mode = (string)param["PARAMETER_MODE"];
+                string name = (string)param["PARAMETER_NAME"];
                 string datatype = (string)param["DATA_TYPE"];
 
                 // make sure the parameters given to us have an appropriate

Thread
Connector/NET commit: r349 - in trunk: . TestSuite mysqlclientrburnett19 Sep