• Icon: Change Request Change Request
    • Resolution: Out of scope
    • Icon: P2: Important P2: Important
    • None
    • SQL Support
    • None
    • Windows XP 32 bits and Windows Vista 64bits
      MySQL 5.1.41
      MySQL ODBC 5.1 connector
      Qt 4.5

      Summary
      --------------
      A very tiny float value cannot be read properly using the chain MySQL -> MySQL ODBC connector -> Qt4 driver -> Qt client application
      e.g. 0.0000421 is read as 4.21 !

      When a SQL float (per default, 32 bit precision ? ) value is below float mantissa value (e.g. 0.0000421), it seems to be stored with the exponent value "e triple character" (e.g 4.21e-005).
      This weird formatting is tied to MySQL and appears as is under phpMyAdmin and a MySQL console. My Qt client application returns 4.21, the exponent value is simply discarded.
      This bug appears only with tiny float. Any value without exponent is read correctly.

      How to repeat:
      -------------------

      1/ deploy MySQL 5.1.41
      2/ Create a table with a float column, store a tiny float value (e.g. 0.0000421)
      3/ Configure an ODBC connection with MySQL ODBC connector
      4/ Write a tiny QT sql client program : connect to MySQL thru Qt ODBC->SQL plugin and retrieve the float value

      Suggested fix:
      ------------------

      1/ If you do not plan to do any calculation with your float value : convert your float columns into varchar(32)
      to ensure maximum mantissa coverage (e.g. 0.0000421 will be stored as is) and prevent any reinterpretation.

      2/ Replace MySQL->ODBC; ODBC->Qt plugin chain by a MySQL->Qt plugin.
      Since Qt does not provide such driver due to MySQL licensing, I had to compile this driver.

      This bug seems too obvious to be Sun' MySQL ODBC connector related.
      I could not imagine a furious horde of ODBC connector users.

      I suspect the MySQL weird float storage and the way the data is retrieved by Qt ODBC driver.
      Data is read as string, stored into a QVariant to be cast as a double (file qsql_odbc : line 1028).

      In mysql Qt driver, data is also read as string (better formatted ?), but passed thru a (smarter ?)
      unicode conversion method (file qt_mysql : line 584).

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

            chehrlic Christian Ehrlicher
            nopnopzero Vincent
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes