Bug #36129 Poor error handling when procedure body cannot be parsed
Submitted: 16 Apr 2008 11:17 Modified: 20 Jul 2009 9:22
Reporter: Gareth Watson Email Updates:
Status: No Feedback Impact on me:
None 
Category:Connector / NET Severity:S3 (Non-critical)
Version:5.2.1 OS:Any
Assigned to: CPU Architecture:Any

[16 Apr 2008 11:17] Gareth Watson
Description:
When a connection is established by a user that does not have permission to read the procedure body from using:

show create procedure <procedure name>

The connector does not gracefully handle the fact that the result set may not contain the information it expects.

Specifically in ISSchemaProvider.ParseProcedureBody there is no test to make sure the opening bracket is in fact located.  This is a key indicator that the data returned from the server is not in the format we expect.

How to repeat:
Create a procedure with a parameter.  Make sure when you execute:

show create procedure <procedure name>

You get something like this returned:

+-------------------------+----------+------------------+
| Procedure               | sql_mode | Create Procedure |
+-------------------------+----------+------------------+
| sp_TestyTest            |          |                  |
+-------------------------+----------+------------------+

In these circumstances the connector errors with:

StartIndex must be smaller than length of string.  StartIndex = -1.

Suggested fix:
I have ISSchemaProvider.ParseProcedureBody to throw an exception specifically stating the error is that it cannot parse the procedure body.  This will help future developers narrow down the problem much more quickly.
[26 Apr 2008 2:49] Reggie Burnett
Gareth

What situation shows this bug?  The code already catches null values on the procedure body and gives a nice exception message.
[20 Jun 2009 9:22] Tonci Grgin
Gareth, any news?
[20 Jul 2009 23:00] Bugs System
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".