Description:
The ADO.NET IDataRecord.GetOrdinal contract requires name lookup to return the ordinal of the named field. When a result set contains column names that differ only by case, Connector/NET should prefer the exact-case match before applying case-insensitive fallback. The current implementation uses only case-insensitive lookup, so the returned ordinal can identify the wrong column. This was found by pengdows.AdoNetApiTest.conformance.
How to repeat:
1. Run a SELECT that returns two columns whose names differ only by case, for example aliases ColumnName and columnname.
2. Execute the command with MySql.Data and obtain the reader.
3. Call reader.GetOrdinal("ColumnName") and reader.GetOrdinal("columnname").
4. Observe that exact-case lookup is not preferred and can return the same/wrong ordinal instead of the exact matching column.
The conformance regression test is DataReader.GetOrdinal_prefers_the_exact_case_match in pengdows.AdoNetApiTest.conformance.
Suggested fix:
Maintain a case-sensitive name-to-ordinal lookup for exact matches, then use the existing case-insensitive lookup only as fallback. Regression tests should cover exact and case-insensitive lookup.
Description: The ADO.NET IDataRecord.GetOrdinal contract requires name lookup to return the ordinal of the named field. When a result set contains column names that differ only by case, Connector/NET should prefer the exact-case match before applying case-insensitive fallback. The current implementation uses only case-insensitive lookup, so the returned ordinal can identify the wrong column. This was found by pengdows.AdoNetApiTest.conformance. How to repeat: 1. Run a SELECT that returns two columns whose names differ only by case, for example aliases ColumnName and columnname. 2. Execute the command with MySql.Data and obtain the reader. 3. Call reader.GetOrdinal("ColumnName") and reader.GetOrdinal("columnname"). 4. Observe that exact-case lookup is not preferred and can return the same/wrong ordinal instead of the exact matching column. The conformance regression test is DataReader.GetOrdinal_prefers_the_exact_case_match in pengdows.AdoNetApiTest.conformance. Suggested fix: Maintain a case-sensitive name-to-ordinal lookup for exact matches, then use the existing case-insensitive lookup only as fallback. Regression tests should cover exact and case-insensitive lookup.