Bug #1388 MyODBC ignores decimals of a float for client using comma as decimal separator
Submitted: 24 Sep 2003 1:28 Modified: 7 Oct 2003 13:45
Reporter: Emery Fabrice NZEYIMANA Email Updates:
Status: Closed Impact on me:
Category:Connector / ODBC Severity:S2 (Serious)
Version:3.51.06 OS:Windows (Windows)
Assigned to: Bugs System CPU Architecture:Any

[24 Sep 2003 1:28] Emery Fabrice NZEYIMANA
The application is VB using MyODBC to connect to the MySQL server.
When the client machine uses English settings (for numbers), everything is OK but when the same application is used on a machine using non-english numbers (Like French), the decimal part of the number is removed before its presented to the application. French settings use a comma (,) as a decimal separator. So, the ODBC driver takes a number with a DOT to be a mixture of strings and digits and removes the digits after the string (. in this case).

How to repeat:
Install MyODBC on a Windows machine. 
Go to the regional settings of your client machine. 
Set the settings to use a comma as a decimal separator as done in the French system (for example 3,45).  Or simply instruct your computer to use French settings for numbers. 
Run a query that should return FLOAT numbers from the MySQL server (stored as 3.54 on the server). The number comes correctly from the server but gets converted into 3.00 before entering the Visual Basic Application.

When you run an Update query a number like 2,35 arrives into the server as 2.00 But a number like 2.35 arrives on the server correctly (as 2.35)

Suggested fix:
Have MyODBC convert numbers that pass through it. When a number like 3.56 comes from the server, MyODBC should convert it considering the locale settings on the client. 

Also another method is to convert the float into a string before coming from the server. I used this and it worked but with a DOT.
[2 Oct 2003 20:11] MySQL Verification Team
I tested MyODBC on Windows XP Portuguese version which uses also the 
comma (,) as a decimal separator.
I built a small graphical application with Borland Builder C++ and
the float numbers were showed correctly with the comma decimal
Then I assume that your applicaction for unknown reason isn't handling
the display of these type of data. Please contact the support of VB
regarding this issue.
[3 Oct 2003 2:36] Emery Fabrice NZEYIMANA
To Miguel: It also displays the floats for me but with all decimal parts changed into 0000 for example 20.765 will show up as 20,000

Just check again to make sure that it will show NON-zero decimal parts (I mean can you see a number like 18,3455 ? 
I worked with this application for 6 months without realizing that non-zeros were changed into zeros.
[3 Oct 2003 7:43] MySQL Verification Team
Done and confirmed. Please see the pictute I sent you in
separate e-mail.
[6 Oct 2003 23:49] Venu Anuganti
Hi !!

This is because of atof() which returns the value based on current locale settings. In order to make it work in the right way for you, i.e. to get decimal digit as ',' and rest of the data,  you need to set the option 'Dont use setlocale' (256) from your DSN options dialog or simply OPTION=256 to your connection string.

Could you please confirm this ?

[7 Oct 2003 7:43] Emery Fabrice NZEYIMANA
It now works with the option 256. But I think it's bug since it should not cut off the decimal part of the number when the user doesn't add that 256 option.

I think this 256 option should be set by default. And for these versions, it should be a recommended thing in the manual and tutorials. Do you support my view?

Thanks for being there!!!!
[7 Oct 2003 13:45] Venu Anuganti
Well, thats correct. We will update the FAQ document to reflect this.

[26 Apr 2004 11:36] Alejandro Perez
Hi, i have this problem and OPTION=256 didnt solved it.  What else i can do? Thanks. Alejandro.
[17 Jul 2005 13:50] Ronal Rodriguez
I´m working in C++builder 6


mount is connectec at column mount in my database. In the database mount default value is 0.00 and format is DECIMAL(10,2)

i have a DBGrid connectec at database for view the results

but, when post in database the DBGrid mount column=34 (not 34.00) :(

Please helpme and Thanks :)