From: Date: November 5 2007 10:01pm Subject: Connector/NET commit: r1070 - in branches/5.0: . Driver/Source TestSuite/Source List-Archive: http://lists.mysql.com/commits/37142 X-Bug: 27436 Message-Id: <200711052101.lA5L16WB010264@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/Exception.cs branches/5.0/TestSuite/Source/ExceptionTests.cs Log: fixed the MySqlException class to set the server error code in the Data[] hash so that DbProviderFactory users can access the server error code (Bug #27436) Modified: branches/5.0/CHANGES =================================================================== --- branches/5.0/CHANGES 2007-11-05 19:47:18 UTC (rev 1069) +++ branches/5.0/CHANGES 2007-11-05 21:01:06 UTC (rev 1070) @@ -26,7 +26,10 @@ just a constructor (Bug #32093) - fixed problem where a syntax error in a set of batch statements could leave the data adapter in a state that appears hung (bug #31930) + - fixed the MySqlException class to set the server error code in the Data[] hash so that + DbProviderFactory users can access the server error code (Bug #27436) + Version 5.0.8 8/16/2007 Bug #28706 Log messages are truncated Modified: branches/5.0/Driver/Source/Exception.cs =================================================================== --- branches/5.0/Driver/Source/Exception.cs 2007-11-05 19:47:18 UTC (rev 1069) +++ branches/5.0/Driver/Source/Exception.cs 2007-11-05 21:01:06 UTC (rev 1070) @@ -57,11 +57,11 @@ : this(msg, inner) { errorCode = errno; + Data.Add("Server Error Code", errno); } - internal MySqlException(string msg, int errno) : this(msg) + internal MySqlException(string msg, int errno) : this(msg, errno, null) { - errorCode = errno; } #if !PocketPC Modified: branches/5.0/TestSuite/Source/ExceptionTests.cs =================================================================== --- branches/5.0/TestSuite/Source/ExceptionTests.cs 2007-11-05 19:47:18 UTC (rev 1069) +++ branches/5.0/TestSuite/Source/ExceptionTests.cs 2007-11-05 21:01:06 UTC (rev 1070) @@ -68,5 +68,22 @@ c2.Close(); } } + + /// + /// Bug #27436 Add the MySqlException.Number property value to the Exception.Data Dictionary + /// + [Test] + public void ErrorData() + { + MySqlCommand cmd = new MySqlCommand("SELEDT 1", conn); + try + { + cmd.ExecuteNonQuery(); + } + catch (Exception ex) + { + Assert.AreEqual(1064, ex.Data["Server Error Code"]); + } + } } }