List:Commits« Previous MessageNext Message »
From:rburnett Date:May 1 2007 10:57pm
Subject:Connector/NET commit: r697 - in branches/5.0: . Driver/Source TestSuite/Source
View as plain text  
Modified:
   branches/5.0/CHANGES
   branches/5.0/Driver/Source/CommandBuilder.cs
   branches/5.0/TestSuite/Source/CommandBuilderTests.cs
Log:
Bug #27679  	MySqlCommandBuilder.DeriveParameters ignores UNSIGNED flag

MySqlCommandBuilder.DeriveParameters was not taking unsigned or real_as_float into
consideration when determine final parameter data types.

Modified: branches/5.0/CHANGES
===================================================================
--- branches/5.0/CHANGES	2007-05-01 20:40:50 UTC (rev 696)
+++ branches/5.0/CHANGES	2007-05-01 20:57:05 UTC (rev 697)
@@ -8,6 +8,7 @@
   Bug #27240 Property value characterset not retrieved/fetched in conn wizard 
   Bug #25947 CreateFormat/CreateParameters Column of DataTypes collection incorrect for
CHAR 
   Bug #27765 Logging does not work
+  Bug #27679 MySqlCommandBuilder.DeriveParameters ignores UNSIGNED flag
    
   Other changes
   -------------

Modified: branches/5.0/Driver/Source/CommandBuilder.cs
===================================================================
--- branches/5.0/Driver/Source/CommandBuilder.cs	2007-05-01 20:40:50 UTC (rev 696)
+++ branches/5.0/Driver/Source/CommandBuilder.cs	2007-05-01 20:57:05 UTC (rev 697)
@@ -116,6 +116,7 @@
             DataSet ds =
command.Connection.ProcedureCache.GetProcedure(command.Connection, spName);
 
             DataTable parameters = ds.Tables["Procedure Parameters"];
+            DataTable procTable = ds.Tables["Procedures"];
             command.Parameters.Clear();
             foreach (DataRow row in parameters.Rows)
             {
@@ -123,8 +124,10 @@
                 p.ParameterName = row["PARAMETER_NAME"].ToString();
                 p.Direction = GetDirection(row["PARAMETER_MODE"].ToString(),
                     row["IS_RESULT"].ToString());
+                bool unsigned = row["FLAGS"].ToString().IndexOf("UNSIGNED") != -1;
+                bool real_as_float =
procTable.Rows[0]["SQL_MODE"].ToString().IndexOf("REAL_AS_FLOAT") != -1;
                 p.MySqlDbType = MetaData.NameToType(row["DATA_TYPE"].ToString(),
-                    false, false, command.Connection);
+                    unsigned, real_as_float, command.Connection);
                 if (!row["CHARACTER_MAXIMUM_LENGTH"].Equals(DBNull.Value))
                     p.Size = (int)row["CHARACTER_MAXIMUM_LENGTH"];
                 if (!row["NUMERIC_PRECISION"].Equals(DBNull.Value))

Modified: branches/5.0/TestSuite/Source/CommandBuilderTests.cs
===================================================================
--- branches/5.0/TestSuite/Source/CommandBuilderTests.cs	2007-05-01 20:40:50 UTC (rev 696)
+++ branches/5.0/TestSuite/Source/CommandBuilderTests.cs	2007-05-01 20:57:05 UTC (rev 697)
@@ -336,5 +336,19 @@
             Assert.AreEqual(1, dt.Rows[0]["id"]);
         }
 
+        /// <summary>
+        /// Bug #27679  	MySqlCommandBuilder.DeriveParameters ignores UNSIGNED flag
+        /// </summary>
+        [Category("5.0")]
+        [Test]
+        public void UnsignedParametersInSP()
+        {
+            execSQL("CREATE PROCEDURE spTest(testid TINYINT UNSIGNED) BEGIN SELECT
testid; END");
+
+            MySqlCommand cmd = new MySqlCommand("spTest", conn);
+            MySqlCommandBuilder.DeriveParameters(cmd);
+            Assert.AreEqual(MySqlDbType.UByte, cmd.Parameters[0].MySqlDbType);
+            Assert.AreEqual(DbType.Byte, cmd.Parameters[0].DbType);
+        }
 	}
 }

Thread
Connector/NET commit: r697 - in branches/5.0: . Driver/Source TestSuite/Sourcerburnett1 May