Bug #92062 sql::ResultSet::getDouble truncates decimal places on system with de_DE locale
Submitted: 17 Aug 2018 15:51 Modified: 23 Aug 2018 15:09
Reporter: Stefan Seifert Email Updates:
Status: Can't repeat Impact on me:
Category:Connector / C++ Severity:S3 (Non-critical)
Version:1.1.8-8.1 OS:SUSE (Leap 42.3)
Assigned to: MySQL Verification Team CPU Architecture:Any
Tags: locale, sql::ResultSet::getDouble, value truncated

[17 Aug 2018 15:51] Stefan Seifert
This is probably a duplicate of Bug #69719. However the ticket is closed and the bug appears to still be present in MySQL Connector/C++ version 1.1.8-8.1 of the c++ connector. Unfortunately, I could not figure out, how to re-open the ticket. 

The bug occurs, when I use MySQL Connector/C++ from a remote system with a de_DE locale setting to fetch data from a server set to en_US.

How to repeat:
Use setlocale(LC_NUMERIC, "de_DE.UTF-8"); in the client program at some point before data is fetched. 

Do a SELECT on a table with a field of double type.

Check the returned value.

Suggested fix:
MySQL's locale setting for data conversion.
[17 Aug 2018 15:58] MySQL Verification Team
Thank you for the bug report. Could you please provide a complete test case (C++ file). Thanks.
[20 Aug 2018 8:58] Stefan Seifert
c++ test case file

Attachment: testcase.cpp (text/x-c++src), 1.50 KiB.

[23 Aug 2018 15:09] MySQL Verification Team
Hi Stefan,

Which version of the driver are you using and where are you connecting to?

I tried latest mysql-connector-c++-8.0.12-linux-glibc2.12-x86-64bit.tar.gz connecting to mysql 8.0.11 and did not reproduce this? Now the driver.h you are using is from jdbc?

g++ xx.cpp -o xx \
  -I /home/arhimed/cppconn/include/jdbc \
  -L /home/arhimed/cppconn/lib64 -lmysqlcppconn