MySQL Lists are EOL. Please join:

List:Commits« Previous MessageNext Message »
From:rburnett Date:November 5 2007 9:01pm
Subject:Connector/NET commit: r1070 - in branches/5.0: . Driver/Source TestSuite/Source
View as plain text  
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();
 			}
 		}
+
+        /// <summary>
+        /// Bug #27436 Add the MySqlException.Number property value to the Exception.Data Dictionary  
+        /// </summary>
+        [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"]);
+            }
+        }
 	}
 }

Thread
Connector/NET commit: r1070 - in branches/5.0: . Driver/Source TestSuite/Sourcerburnett5 Nov