Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-5179

Floating point number truncation in qsqlpsql plugin under linux

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: P2: Important P2: Important
    • 4.6.0
    • 4.5.2, 4.5.3
    • Core: Plugins, SQL Support
    • None
    • ae576ea123d0625eceb9904e2039b2183cb82a0b

      The postgresql driver plugin distributed with the official Qt 4.5.2 and 4.5.3 release uses the strtod(val) function from libc to convert the result strings to double.
      Under current linux distributions (Mandriva 2009.1 or Suse 11.1 or 11.2RC1) this function uses the decimal separator from the current local to execute the conversion.
      In case of locales (ex. german or hungarian locales) which use comma (',') as the decimal separator, the double values will be truncated.

      This problem can be corrected by replacing strtod(val) to QString::fromAscii(val).toDouble() in qsql_psql.cpp, which uses dot ('.') as decimal separator in every locale.

      I attached the modified source code, too. The modification is marked by a conditional compiling directive: #ifdef DANI

      This problem currently not effects the win32 version of the plugin compiled by mingw32.
      Under Mac-OSX, I haven't tested the plugin.

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            bilking Bill King
            dbrand Denes Brandszajz
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes