MySQL Lists are EOL. Please join:

List:Commits« Previous MessageNext Message »
From:rburnett Date:December 19 2006 5:39pm
Subject:Connector/NET commit: r510 - in trunk: TestSuite mysqlclient/core
View as plain text  
Modified:
   trunk/TestSuite/Syntax.cs
   trunk/mysqlclient/core/MySqlStream.cs
Log:
Bug #25178 Addition message in error 

Fixed this by parsing off the state code that precedes the message.

Modified: trunk/TestSuite/Syntax.cs
===================================================================
--- trunk/TestSuite/Syntax.cs	2006-12-19 17:25:47 UTC (rev 509)
+++ trunk/TestSuite/Syntax.cs	2006-12-19 17:39:06 UTC (rev 510)
@@ -415,5 +415,23 @@
                 Assert.Fail(ex.Message);
             }
         }
+
+        /// <summary>
+        /// Bug #25178 Addition message in error 
+        /// </summary>
+        [Test]
+        public void ErrorMessage()
+        {
+            MySqlCommand cmd = new MySqlCommand("SELEKT NOW() as theTime", conn);
+            try
+            {
+                object o = cmd.ExecuteScalar();
+            }
+            catch (MySqlException ex)
+            {
+                string s = ex.Message;
+                Assert.IsFalse(s.StartsWith("#"));
+            }
+        }
 	}
 }

Modified: trunk/mysqlclient/core/MySqlStream.cs
===================================================================
--- trunk/mysqlclient/core/MySqlStream.cs	2006-12-19 17:25:47 UTC (rev 509)
+++ trunk/mysqlclient/core/MySqlStream.cs	2006-12-19 17:39:06 UTC (rev 510)
@@ -163,6 +163,11 @@
 
 				int code = ReadInteger(2);
 				string msg = ReadString();
+                if (msg.StartsWith("#"))
+                {
+                    string stateCode = msg.Substring(1, 5);
+                    msg = msg.Substring(6);
+                }
 				throw new MySqlException(msg, code);
 			}
 			isLastPacket = (peek == 0xfe && (inLength < 9));

Thread
Connector/NET commit: r510 - in trunk: TestSuite mysqlclient/corerburnett19 Dec