[CONC-371] Incorrect fractional part conversion Created: 2018-11-05  Updated: 2018-11-07  Resolved: 2018-11-06

Status: Closed
Project: MariaDB Connector/C
Component/s: None
Affects Version/s: None
Fix Version/s: 3.0.7, 3.1.0

Type: Bug Priority: Minor
Reporter: Lawrin Novitsky Assignee: Georg Richter
Resolution: Fixed Votes: 0
Labels: None

Attachments: File fractional_string_test.diff    
Issue Links:
Problem/Incident
causes ODBC-198 Incorrect second fraction number if s... Closed

 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.


Generated at Thu Feb 08 03:04:50 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.