Bug #96398 sql::ResultSet -> findColumn() is not case sensitive
Submitted: 1 Aug 2019 12:38 Modified: 24 Nov 2020 17:40
Reporter: Csaba Bordas Email Updates:
Status: Closed Impact on me:
None 
Category:Connector / C++ Severity:S3 (Non-critical)
Version: OS:Any
Assigned to: CPU Architecture:x86

[1 Aug 2019 12:38] Csaba Bordas
Description:
The function findColumn(const sql::SQLString& columnLabel) is not case sensitive!
If column named 'Result' exists in my ResultSet the function gives true in both 'Result' and 'result' as well. Column labels 'Result' and 'result' are not the same! For exmaple : SELECT JSON_OBJECT('City02b', 'B', 'Population', 222222) AS 'Result', "test_str" AS result;

ii  libmysqlclient-dev                                    5.7.26-1debian9                 amd64                           MySQL development headers
ii  libmysqlclient20:amd64                                5.7.26-1debian9                 amd64                           MySQL shared client libraries
ii  libmysqlcppconn-dev:amd64                             8.0.17-1debian9                 amd64                           Development header files and libraries for MySQL C++ client applications
ii  libmysqlcppconn7:amd64                                8.0.17-1debian9                 amd64                           MySQL Driver for C++ which mimics the JDBC 4.0 API
ii  libmysqlcppconn8-2:amd64                              8.0.17-1debian9                 amd64                           MySQL database connector for C++

How to repeat:
std::unique_ptr< sql::PreparedStatement >  pstmt;

pstmt.reset( con->prepareStatement(" SELECT JSON_OBJECT('City03a', 'A', 'Population', 111111) AS 'Result'") );

std::unique_ptr<sql::ResultSet> mysql_result( pstmt->executeQuery() );

Check the results by:
auto column_found = res->findColumn( "result" );
	and 
auto column_found = res->findColumn( "Result" );

Suggested fix:
Modify this function to work as case sensitive
[1 Aug 2019 13:53] MySQL Verification Team
Hello Mr. Bordas,

Thank you for your bug report.

I have tested the method in question and it is true that it is case insensitive.

Verified as reported.
[24 Nov 2020 17:40] Paul DuBois
Posted by developer:
 
Fixed in 8.0.23.

All calls that allow a column name, such as findColumn(),
getString(), and getInt(), are now case-sensitive.
[30 Nov 2020 13:09] MySQL Verification Team
Thank you, Paul ......