From: Date: November 5 2007 10:01pm Subject: Connector/NET commit: r1071 - in branches/5.1: . Driver/Source TestSuite/Source List-Archive: http://lists.mysql.com/commits/37143 X-Bug: 27436 Message-Id: <200711052101.lA5L1Pk2010419@bk-internal.mysql.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Modified: branches/5.1/CHANGES branches/5.1/Driver/Source/Exception.cs branches/5.1/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.1/CHANGES =================================================================== --- branches/5.1/CHANGES 2007-11-05 21:01:06 UTC (rev 1070) +++ branches/5.1/CHANGES 2007-11-05 21:01:25 UTC (rev 1071) @@ -102,7 +102,9 @@ 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 - Fixed a problem with compression over a network. We were letting the inflate stream read Modified: branches/5.1/Driver/Source/Exception.cs =================================================================== --- branches/5.1/Driver/Source/Exception.cs 2007-11-05 21:01:06 UTC (rev 1070) +++ branches/5.1/Driver/Source/Exception.cs 2007-11-05 21:01:25 UTC (rev 1071) @@ -59,12 +59,13 @@ : this(msg, inner) { errorCode = errno; + Data.Add("Server Error Code", errno); } - internal MySqlException(string msg, int errno) : this(msg) - { - errorCode = errno; - } + internal MySqlException(string msg, int errno) + : this(msg, errno, null) + { + } #if !CF private MySqlException(SerializationInfo info, StreamingContext context) : base(info, context) Modified: branches/5.1/TestSuite/Source/ExceptionTests.cs =================================================================== --- branches/5.1/TestSuite/Source/ExceptionTests.cs 2007-11-05 21:01:06 UTC (rev 1070) +++ branches/5.1/TestSuite/Source/ExceptionTests.cs 2007-11-05 21:01:25 UTC (rev 1071) @@ -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"]); + } + } + } }