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

MySQL incorrect sub-second precision

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P3: Somewhat important
    • Resolution: Done
    • Affects Version/s: 4.8.4
    • Fix Version/s: None
    • Component/s: SQL Support
    • Labels:
      None
    • Environment:
      Qt 4.8.4 / win7 x64 / 32-bit / msvc10
    • Commits:
      7216387370203fc8f49d76cc2cb68bb5286c8dff

      Description

      MySQL supports sub-second precision (actually microsecond) for DATETIME, TIMESTAMP and TIME types since version 5.6.4 (see http://dev.mysql.com/doc/refman/5.6/en/fractional-seconds.html), together with a recent MySQL C connector.

      However there is a bug in qsql_mysql.cpp where there is a confusion between milli and microseconds when storing a datetime into database:

      myTime->second_part = time.msec();

      should become:

      myTime->second_part = time.msec()*1000;

      This patch works fine on my machine (tested only with DATETIME fields).

        Attachments

          Issue Links

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

            Activity

              People

              Assignee:
              ccomparon Cyril C
              Reporter:
              ccomparon Cyril C
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:

                  Gerrit Reviews

                  There are no open Gerrit changes