Bug #47467 Two simple changes for DataReader
Submitted: 21 Sep 2009 7:15 Modified: 24 Mar 2010 14:36
Reporter: Moshe Lampert Email Updates:
Status: Closed Impact on me:
Category:Connector / NET Severity:S4 (Feature request)
Version:6.1.4 OS:Any
Assigned to: Reggie Burnett CPU Architecture:Any
Triage: D5 (Feature request)

[21 Sep 2009 7:15] Moshe Lampert
Add to MySqlDataReader one function, and change other to return useful Exception
1. GetFieldType with column name
2. GetOridinal - return what name of not fouund column

How to repeat:
Use MySQLDataReader to fetch data from MySQL Database

Suggested fix:
1. GetFieldType with column name:

	public override double GetFieldType(string column)
			return GetFieldType(GetOrdinal(column));

datareader.cs, line 439

2. GetOridinal - return what name of not-fouund column:

            throw new IndexOutOfRangeException(Resources.CouldNotFindColumnName + ":" +name);

ResultSet.cs, line 114

I think that this two simple changes can make the DataReader more useful and more simple to use.
[21 Sep 2009 7:35] Tonci Grgin
Hi Moshe and thanks for your reasonable feature request.
[11 Mar 2010 20:57] 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:


801 Reggie Burnett	2010-03-11
      - added two requested features -- MySqlDataReader.GetFieldType(string columnname) &
        MySqlDataReader.GetOrdinal() includes the name of the column in the exception when not found
        (bug #47467)
[11 Mar 2010 21:02] Reggie Burnett
fixed in 6.0.6, 6.1.4, 6.2.3, and 6.3.2+
[24 Mar 2010 14:36] Tony Bedford
A 'change' entry has been added to changelogs 6.0.6, 6.1.4, 6.2.3, 6.3.2:

MySQL Connector/NET has been changed to include MySqlDataReader.GetFieldType(string columnname). Further, MySqlDataReader.GetOrdinal() now includes the name of the column in the exception if the column is not found.