Bug #56755 MySqlHelper.ExecuteReader missing overload
Submitted: 13 Sep 2010 18:06 Modified: 28 Sep 2010 13:53
Reporter: Travis Duncan Email Updates:
Status: Closed Impact on me:
None 
Category:Connector / NET Severity:S3 (Non-critical)
Version:6.2.4.0 OS:Microsoft Windows
Assigned to: CPU Architecture:Any
Tags: MySqlHelper

[13 Sep 2010 18:06] Travis Duncan
Description:
MySqlHelper.ExecuteReader doesn't include an overload accepting MySqlParameter objects when using a MySqlConnection.  However, MySqlHelper DOES include an overload for MySqlParameter objects when using a string object containing the connection string to the database.

How to repeat:
Code blocks utilizing an ideal overload will not compile due to the missing functionality:

string query = "SELECT `baconBits` FROM `ChefSalad` WHERE `owner` = ?OwnerName";

using (MySqlDataReader reader = MySqlHelper.ExecuteReader(DatabaseConnection, query, new MySqlParameter("?OwnerName", "Jim Gaffigan")))
{

      while (reader.Read())
      {

           // ... create data/model objects here

      }

}

Suggested fix:
An overloaded implementation of the MySqlHelper.ExecuteReader method, which accepts a MySqlConnection object along with a params array of MySqlParameters, would be nice.

For the moment, a work around would be to create a MySqlCommand, add in parameters with MySqlCommand.Parameters.AddWithValue("?Parameter", valueObl) then call ExecuteReader on the MySqlCommand.
[17 Sep 2010 16:24] 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/118502

852 Reggie Burnett	2010-09-17
      - Added MySqlHelper.ExecuteReader that takes an external connection and array of paramters (bug #56755)
[17 Sep 2010 16:26] Reggie Burnett
fixed in 6.1.6, 6.2.5, and 6.3.5+
[28 Sep 2010 13:53] Tony Bedford
An entry has been added to the 6.1.6, 6.2.5, and 6.3.5 changelogs:

MySqlHelper.ExecuteReader did not include an overload accepting MySqlParameter objects when using a MySqlConnection. However, MySqlHelper did include an overload for MySqlParameter objects when using a string object containing the connection string to the database.