List:Commits« Previous MessageNext Message »
From:rburnett Date:December 19 2006 6:41pm
Subject:Connector/NET commit: r511 - in branches/1.0: TestSuite mysqlclient
View as plain text  
Modified:
   branches/1.0/TestSuite/Syntax.cs
   branches/1.0/mysqlclient/PacketReader.cs
Log:
Bug #25178 Addition message in error 

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

Modified: branches/1.0/TestSuite/Syntax.cs
===================================================================
--- branches/1.0/TestSuite/Syntax.cs	2006-12-19 17:39:06 UTC (rev 510)
+++ branches/1.0/TestSuite/Syntax.cs	2006-12-19 17:41:02 UTC (rev 511)
@@ -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: branches/1.0/mysqlclient/PacketReader.cs
===================================================================
--- branches/1.0/mysqlclient/PacketReader.cs	2006-12-19 17:39:06 UTC (rev 510)
+++ branches/1.0/mysqlclient/PacketReader.cs	2006-12-19 17:41:02 UTC (rev 511)
@@ -145,8 +145,13 @@
 			{
 				ReadByte();
 				int errorCode = ReadInteger(2);
-				string msg = ReadString();
-				throw new MySqlException(msg, errorCode);
+                string msg = ReadString();
+                if (msg.StartsWith("#"))
+                {
+                    string stateCode = msg.Substring(1, 5);
+                    msg = msg.Substring(6);
+                } 
+                throw new MySqlException(msg, errorCode);
 			}
 
 		}

Thread
Connector/NET commit: r511 - in branches/1.0: TestSuite mysqlclientrburnett19 Dec