Uploaded image for project: 'MariaDB Connector/C'
  1. MariaDB Connector/C
  2. CONC-371

Incorrect fractional part conversion

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 3.1.0, 3.0.7
    • Labels:
      None

      Description

      If datetime value is represented by a string, and fetched to MYSQL_TIME buffer, the fractional part is converted incorrectly.
      str_to_TIME simply read the number after decimal point, and save it to the second_part of the MYSQL_TIME structure, no matter of how many zeros it has. While it has to save number of microseconds, for 0.1 or 0.01 or 0.000000001 the second_part will be 1.
      Attached is the diff against master branch with the testcase.

      To fix this, str_to_TIME probably should memorize '.' position, and using it calculate number of decimal digits, compare it to 6, and then multiply or divide the number by 10 required number of times.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              georg Georg Richter
              Reporter:
              Lawrin Lawrin Novitsky
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: