From: Date: July 10 2007 6:01pm Subject: Connector/NET commit: r781 - in trunk: . Driver/Source TestSuite/Source List-Archive: http://lists.mysql.com/commits/30617 X-Bug: 29312, 29312 Message-Id: <200707101601.l6AG1jUQ019371@bk-internal.mysql.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Modified: trunk/CHANGES trunk/Driver/Source/Statement.cs trunk/TestSuite/Source/ParameterTests.cs Log: Bug #29312 System.FormatException if parameter not found Fixed problem where a statement that has parameters that is executed without defining those parameters would throw a System.FormatException rather than a MySqlException (bug #29312) Modified: trunk/CHANGES =================================================================== --- trunk/CHANGES 2007-07-10 15:56:19 UTC (rev 780) +++ trunk/CHANGES 2007-07-10 16:01:44 UTC (rev 781) @@ -64,6 +64,9 @@ - Fixed problem with calling stored procedures in databases that have hyphens in their names. We were not using backticks to quote the database and sproc name when querying for metadata. (Bug #29526) + - Fixed problem where a statement that has parameters that is executed without + defining those parameters would throw a System.FormatException rather than + a MySqlException (bug #29312) Version 5.0.7 5/16/2007 Modified: trunk/Driver/Source/Statement.cs =================================================================== --- trunk/Driver/Source/Statement.cs 2007-07-10 15:56:19 UTC (rev 780) +++ trunk/Driver/Source/Statement.cs 2007-07-10 16:01:44 UTC (rev 781) @@ -167,7 +167,7 @@ if (Connection.Settings.UseOldSyntax) return false; throw new MySqlException( - String.Format(Resources.ParameterMustBeDefined)); + String.Format(Resources.ParameterMustBeDefined, parmName)); } parameter.Serialize(stream, false); Modified: trunk/TestSuite/Source/ParameterTests.cs =================================================================== --- trunk/TestSuite/Source/ParameterTests.cs 2007-07-10 15:56:19 UTC (rev 780) +++ trunk/TestSuite/Source/ParameterTests.cs 2007-07-10 16:01:44 UTC (rev 781) @@ -514,5 +514,25 @@ cmd.Parameters.RemoveAt("?id1"); MySqlParameter p = cmd.Parameters["?id6"]; } + + /// + /// Bug #29312 System.FormatException if parameter not found + /// + [Test] + public void MissingParameter() + { + MySqlCommand cmd = new MySqlCommand("INSERT INTO test(id) VALUES (?id)", conn); + try + { + cmd.ExecuteNonQuery(); + } + catch (MySqlException) + { + } + catch (Exception ex) + { + Assert.Fail(ex.Message); + } + } } }