From: Date: July 10 2007 5:56pm Subject: Connector/NET commit: r780 - in branches/5.0: . Driver/Source TestSuite/Source List-Archive: http://lists.mysql.com/commits/30616 X-Bug: 29312, 29312 Message-Id: <200707101556.l6AFuKEx018918@bk-internal.mysql.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Modified: branches/5.0/CHANGES branches/5.0/Driver/Source/Statement.cs branches/5.0/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: branches/5.0/CHANGES =================================================================== --- branches/5.0/CHANGES 2007-07-09 21:37:18 UTC (rev 779) +++ branches/5.0/CHANGES 2007-07-10 15:56:19 UTC (rev 780) @@ -18,6 +18,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: branches/5.0/Driver/Source/Statement.cs =================================================================== --- branches/5.0/Driver/Source/Statement.cs 2007-07-09 21:37:18 UTC (rev 779) +++ branches/5.0/Driver/Source/Statement.cs 2007-07-10 15:56:19 UTC (rev 780) @@ -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: branches/5.0/TestSuite/Source/ParameterTests.cs =================================================================== --- branches/5.0/TestSuite/Source/ParameterTests.cs 2007-07-09 21:37:18 UTC (rev 779) +++ branches/5.0/TestSuite/Source/ParameterTests.cs 2007-07-10 15:56:19 UTC (rev 780) @@ -508,5 +508,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); + } + } } }