Bug #67793 MySQL ODBC drivers incorrectly returns TIME columns, where value > '99:59:59'

Submitted: 3 Dec 2012 7:42 Modified: 23 Jul 2013 15:31
Reporter: [ name withheld ] Email Updates:
Status: Closed Impact on me:
None 
Category:Connector / ODBC Severity:S2 (Serious)
Version:5.2.2 OS:Any
Assigned to: Bogdan Degtyariov CPU Architecture:Any

[3 Dec 2012 7:42] [ name withheld ]
Description:
When you read column data using SQLGetData into SQL_C_TYPE_TIME then:

- if TIME column contains value <= '99:59:59' then data are correctly filled into SQL_TIME_STRUCT: hour=99, minute=59, second=59.

- but if TIME column contains value > '99:59:59' f.e. '120:34:56' (more than 6 digits) then data are filled : hour=12, minute=03, second=45
(values are taken from left by 2 digits: 12 03 45 6, instead of 120 34 56)

How to repeat:
Use f.e. in Pascal: SQLGetData(, , SQL_C_TYPE_TIME, @ODBCTimeStruct, SizeOf(SQL_TIME_STRUCT), @StrLenOrInd);
And read any TIME column with TIME value >= '100:00:00'
[6 Dec 2012 12:28] [ name withheld ]
Problem may be in utility.c in function str_to_time_st:
    ts->hour=   digit(buff[0])*10+digit(buff[1]);
    ts->minute= digit(buff[2])*10+digit(buff[3]);
    ts->second= digit(buff[4])*10+digit(buff[5]); 

here is hard coded, that hours are 2 digits only, but it is not ok.
[16 Jan 2013 11:18] Bogdan Degtyariov
Verified using 5.2.3
[16 Jan 2013 11:53] Bogdan Degtyariov
Patch and test case

Attachment: bug67793.patch (application/octet-stream, text), 2.40 KiB.

[20 Jun 2013 6:18] Bogdan Degtyariov
Pushed to the revision 1149 of Connector/ODBC 5.2.
[23 Jul 2013 15:31] Daniel So
Added an entry to the Connector/ODBC 5.2.6 changelog:

When reading TIME column data using the SQLGetData method into the SQL_C_TYPE_TIME datatype, errors occured when the time string contained more than 6-digits (e.g., 120:53:44).

Portions of this website are copyright © 2001, 2002 The PHP Group

Page generated in 0.039 sec. using MySQL 8.4.7-u6-cloud

Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.