From: Date: October 23 2006 5:44pm Subject: Connector/NET commit: r427 - in branches/1.0: . TestSuite mysqlclient List-Archive: http://lists.mysql.com/commits/14198 X-Bug: 23268 Message-Id: <200610231544.k9NFiwkO017977@bk-internal.mysql.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Modified: branches/1.0/CHANGES branches/1.0/TestSuite/StoredProcedure.cs branches/1.0/mysqlclient/StoredProcedure.cs Log: Bug #23268 System.FormatException when invoking procedure with ENUM input parameter This was fixed by adding enum to the list of types that is checked in the parameter parsing code. The old code was assuming the parameter was decimal which led to the format exception. Modified: branches/1.0/CHANGES =================================================================== --- branches/1.0/CHANGES 2006-10-23 15:38:08 UTC (rev 426) +++ branches/1.0/CHANGES 2006-10-23 15:44:57 UTC (rev 427) @@ -1,3 +1,11 @@ +Version 1.0.9 + Other changes + ------------- + + Bugs fixed or addressed + ----------------------- + Bug #23268 System.FormatException when invoking procedure with ENUM input parameter + Version 1.0.8 RC Other changes Modified: branches/1.0/TestSuite/StoredProcedure.cs =================================================================== --- branches/1.0/TestSuite/StoredProcedure.cs 2006-10-23 15:38:08 UTC (rev 426) +++ branches/1.0/TestSuite/StoredProcedure.cs 2006-10-23 15:44:57 UTC (rev 427) @@ -946,5 +946,39 @@ Thread.CurrentThread.CurrentUICulture = uiCulture; } } + + /// + /// Bug #23268 System.FormatException when invoking procedure with ENUM input parameter + /// + [Test] + public void ProcEnumParamTest() + { + execSQL("DROP TABLE IF EXISTS test"); + execSQL("CREATE TABLE test(str VARCHAR(50), e ENUM ('P','R','F','E'), i INT(6))"); + execSQL("CREATE PROCEDURE spTest(IN p_enum ENUM('P','R','F','E')) BEGIN " + + "INSERT INTO test (str, e, i) VALUES (null, p_enum, 55); END"); + + try + { + MySqlCommand cmd = new MySqlCommand("spTest", conn); + cmd.CommandType = CommandType.StoredProcedure; + cmd.Parameters.Add("?p_enum", "P"); + cmd.Parameters["?p_enum"].Direction = ParameterDirection.Input; + using (MySqlDataReader reader = cmd.ExecuteReader()) + { + } + cmd.CommandText = "SELECT e FROM test"; + cmd.CommandType = CommandType.Text; + using (MySqlDataReader reader = cmd.ExecuteReader()) + { + reader.Read(); + Assert.AreEqual("P", reader.GetString(0)); + } + } + catch (MySqlException ex) + { + Assert.Fail(ex.Message); + } + } } } Modified: branches/1.0/mysqlclient/StoredProcedure.cs =================================================================== --- branches/1.0/mysqlclient/StoredProcedure.cs 2006-10-23 15:38:08 UTC (rev 426) +++ branches/1.0/mysqlclient/StoredProcedure.cs 2006-10-23 15:44:57 UTC (rev 427) @@ -361,7 +361,7 @@ p.MySqlDbType = GetTypeFromName(typeName, unsigned, real_as_float); - if (end > start && p.MySqlDbType != MySqlDbType.Set) + if (end > start && p.MySqlDbType != MySqlDbType.Set && p.MySqlDbType != MySqlDbType.Enum) { size = type.Substring(start + 1, end - (start + 1)); string[] parts = size.Split(new char[] { ',' });