List:MySQL ODBC« Previous MessageNext Message »
From:Michael Widenius Date:April 22 1999 2:05am
Subject:Why setlocale(LC_NUMERIC,"English") in ODBC driver
View as plain text  
>>>>> "Kari" == Kari Lempiainen <kari@stripped> writes:

Kari> Hello world,
Kari>  I'm running MySQL Server 3.22.20a in my Linux system within my "home
Kari> network". I have tables with float and double columns. I need to
Kari> access the data with my NT 4.0 boxes through ODBC.

Kari>  I started to wonder why the float values came though ODBC interface
Kari> as integers, ie. decimal parts dropped, when I imported the data to
Kari> various applications in NT. I just downloaded the latest source code
Kari> for the MyODBC driver to check from the source what is happening. I
Kari> run my NTs with decimal points set as "," in regional settings, as a
Kari> standard in Finland. The MyODBC driver forces the locale settings in
Kari> four points in source to the Enlish standard ("." for decimal point),
Kari> and this confuses my applications. When I changed the lines in code
Kari> and recompiled the ODBC driver, I started getting valid floating point
Kari> values from the MySQL database.

Kari>  Why is the ODBC driver forcing the locale to English???


The problem is that the SQL standard requires numbers to have '.' and
not ','.

MyODBC sets the locale to '.' to fix some problems in some
applications involving ','.
(Before I added the English locale, MyODBC had a lot of problems with
some applications in different locales)

As MyODBC normally returns float/double as floating point values, the
locale shouldn't affect most applications.

What exactly didn't work for you and what did you change to get this
to work?

Why setlocale(LC_NUMERIC,"English") in ODBC driver(Kari Lempiainen)21 Apr
  • Why setlocale(LC_NUMERIC,"English") in ODBC driverMichael Widenius22 Apr
    • Re: Why setlocale(LC_NUMERIC,"English") in ODBC driver(Kari Lempiainen)22 Apr
      • Re: Why setlocale(LC_NUMERIC,"English") in ODBC driverMichael Widenius25 Apr