Bug #32093 MySqlParameter Constructor does not allow Direction of anything other than Input
Submitted: 5 Nov 2007 0:58 Modified: 13 Nov 2007 11:41
Reporter: John Crouch Email Updates:
Status: Closed Impact on me:
None 
Category:Connector / NET Severity:S3 (Non-critical)
Version:5.1.3 OS:Any
Assigned to: CPU Architecture:Any
Tags: MySqlParameter, Parameter

[5 Nov 2007 0:58] John Crouch
Description:
There appears to be some legacy code left in a couple of the contructors of the MySqlParameter class in the 5.1.3 Connector.

If you pass a ParameterDirection of anything other than Input you will receive this exception:

"Only input parameters are supported by MySql"

To work around this bug simply create the parameter without specifying the direction then set the direction property as needed.

How to repeat:
Simply creating a MySqlParameter object will cause the exception:

MySqlParameter NewParam = new MySqlParameter("P1", MySql.Data.MySqlClient.MySqlDbType.VarChar, 50, ParameterDirection.Output, true, 0, 0, "Name", DataRowVersion.Default, "");

Suggested fix:
Simply remove the legacy code from the Constructors that was left over from when the Connector did not support other parameter directions.
[5 Nov 2007 18:14] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/37117
[5 Nov 2007 18:16] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/37118
[5 Nov 2007 18:21] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/37119
[5 Nov 2007 18:21] Reggie Burnett
Fixed in 1.0.11, 5.0.9, and 5.1.4
[13 Nov 2007 11:41] MC Brown
A note has been added to the 1.0.11, 5.0.9 and 5.1.4 changelogs: 

Creation of parameter objects with non-input direction using a
        constructor would fail. This was cause by some old legacy code
        preventing their use.