Bug #4193 SQLGetTypeInfo reports NO avaliable data types matching SQL_TIMESTAMP
Submitted: 17 Jun 2004 18:25 Modified: 11 Apr 2005 19:02
Reporter: James Hargreaves Email Updates:
Status: Closed Impact on me:
None 
Category:Connector / ODBC Severity:S2 (Serious)
Version:3.51 OS:Windows (XP)
Assigned to: Timothy Smith CPU Architecture:Any

[17 Jun 2004 18:25] James Hargreaves
Description:
MyODBC driver reports that it cannot map a SQL_TIMESTAMP field when making an SQLGetTypeInfo call. I would have suspected it to return a datetime.

This is EXACTLY the same problem as described in bug #450 which was fixed in the version I am using - presume this must be due to XP?

How to repeat:
Open a connection 

Make a call to SQLGetTypeInfo, with SQL_TIMESTAMP as the data type requested.

Call returns SQL_SUCCESS, but a fetch on it returns SQL_NO_DATA_FOUND.

Suggested fix:
Fix SQLGetTypeInfo call to return DATETIME type information for SQL_TIMESTAMP
data type request.
[29 Jul 2004 23:36] Timothy Smith
I am attaching a test program which demonstrates this problem.  On FreeBSD 5.2, MyODBC from BK tree, MySQL 4.0.20, I get:

tim@sand:m/odbc/t$ ./typeinfo
TYPE_NAME  DATA_TYPE  COLUMN_SIZE  LITERAL_PREFIX  LITERAL_SUFFIX CREATE_PARAMS  NULLABLE  CASE_SENSITIVE  SEARCHABLE  UNSIGNED_ATTRIBUTE  FIXED_PREC_SCALE  AUTO_UNIQUE_VALUE LOCAL_TYPE_NAME  MINIMUM_SCALE  MAXIMUM_SCALE  SQL_DATATYPE  SQL_DATETIME_SUB NUM_PREC_RADIX  INTERVAL_PRECISION  
--

rows fetched:0

If I change from     rc = SQLGetTypeInfo(hstmt, SQL_TIMESTAMP); to     rc = SQLGetTypeInfo(hstmt, SQL_ALL_TYPES);, then I get 49 rows.

Timothy
[29 Jul 2004 23:38] Timothy Smith
C program which shows the bug

Attachment: typeinfo.c (application/octet-stream, text), 7.00 KiB.

[10 Aug 2004 19:14] Peter Harvey
slightly revised form of previously uploaded example (extra arg on command line and builds on XP)

Attachment: test.c (text/plain), 7.13 KiB.

[10 Aug 2004 19:15] Peter Harvey
The test does not produce the error on XP using MyODBC 3.51.9 and MySQL 4.0.20 as client. I suspect that this was fixed during the fix of another bug.