Bug #30939 SQLGetTypeInfo returns 6 instead of 8 for COLUMN_SIZE for SQL_TYPE_TIME
Submitted: 10 Sep 2007 22:04 Modified: 13 Sep 2007 17:27
Reporter: Colin Stearman Email Updates:
Status: Closed Impact on me:
None 
Category:Connector / ODBC Severity:S2 (Serious)
Version:3.51.19 OS:Any
Assigned to: Jim Winstead CPU Architecture:Any

[10 Sep 2007 22:04] Colin Stearman
Description:
The string length of a time value returned by SQLGetTypeInfo is 6 for parameter COLUMN_SIZE, for data type SQL_TYPE_TIME.  This is incorrect.  

The MS ODBC documentation says:
------------
SQL_TYPE_DATE[c] 10 (the number of characters in the yyyy-mm-dd format).
 
SQL_TYPE_TIME[c] 8 (the number of characters in the hh-mm-ss format), or 9 + s (the number of characters in the hh:mm:ss[.fff…] format, where s is the seconds precision). 
SQL_TYPE_TIMESTAMP 16 (the number of characters in the yyyy-mm-dd hh:mm format) 
19 (the number of characters in the yyyy-mm-dd hh:mm:ss format)
or
20 + s (the number of characters in the yyyy-mm-dd hh:mm:ss[.fff…] format, where s is the seconds precision).
------------

A check of values returned for SQL_TYPE_DATE and SQL_TYPE_TIMESTAMP are 10 and 23 respectively, and are consistent with the above.

Presumably SQL_TYPE_TIME should return either 8, or 9 + s. 

Colin

How to repeat:
Call SQLGetTypeInfo for type SQL_TYPE_TIME and view returned value for COLUMN_SIZE

Suggested fix:
Code correction
[12 Sep 2007 5:38] Jim Winstead
Fix COLUMN_LENGTH of SQL_TYPE_TIME

Attachment: bug30939.diff (text/plain), 1.89 KiB.

[12 Sep 2007 6:15] Jim Winstead
The fix for this bug has been committed, it will be in the next release (3.51.21).
[13 Sep 2007 17:27] MC Brown
A note has been added to the 3.51.21 changelog: 

The wrong COLUMN_SIZE would be returned by SQLGetTypeInfo for the TIME columns (SQL_TYPE_TIME).