From: Date: December 19 2006 6:41pm Subject: Connector/NET commit: r511 - in branches/1.0: TestSuite mysqlclient List-Archive: http://lists.mysql.com/commits/17175 X-Bug: 25178 Message-Id: <200612191741.kBJHf2O9016122@bk-internal.mysql.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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); } } + + /// + /// Bug #25178 Addition message in error + /// + [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); } }