Bug #28657 ODBC Connector returns FALSE on SQLGetTypeInfo with DATETIME (wxWindows latest)
Submitted: 24 May 2007 14:38 Modified: 26 Jul 2007 14:25
Reporter: Christian Dankbar Email Updates:
Status: Closed Impact on me:
Category:Connector / ODBC Severity:S2 (Serious)
Version:3.51 & 5.0 OS:Windows (Win2000/XP)
Assigned to: Jim Winstead CPU Architecture:Any
Tags: datetime, ODBC, wxWidgets, wxWindows

[24 May 2007 14:38] Christian Dankbar
When using wxWidgets as ODBC connection library for Win32/Linux applications and trying to connect to a myODBC database, the connection always fails. When debugging the library connection function, it seems that the myODBC connector returns FALSE for DATETIME when supported data types are polled by the library implementation prior to connection.

How to repeat:
Win32 (2000/XP): set up a ODBC data source using MySQL and latest myODBC connector, download the latest wxWidgets (http://www.wxwidgets.org/downloads/ - 2.8.4 is latest stable as of 24. May 2007, "wxMSW" is the name of the Win32 version), compile the DBBrowse demo application (located in the subfolder "demos") and run/debug it. It will fail in the function call "Open()" of the class "wxDb" when testing for the supported datatypes: the call "getDataTypeInfo(SQL_DATETIME,typeInfDate)" does not return SQL_SUCCESS.
FYI: The Win32 function used is "SQLGetTypeInfo()" from the "Microsoft Platform SDK for Windows Server R2"

Suggested fix:
Make the ODBC connector returning SQL_SUCCESS for such a datatype info request.
[24 May 2007 17:45] Jess Balint
Can you include an ODBC trace log?
[30 May 2007 0:56] Jim Winstead
I can confirm this for the 3.51 series, because we use SQL_TIMESTAMP for the DATETIME type for some reason. We'll have to investigate to figure out why.

I haven't checked what the 5.0 driver does.
[30 May 2007 8:13] Christian Dankbar
The 5.0 (I tested version 5.00.11 beta) shows the same behavior.
[10 Jul 2007 19:36] Jim Winstead
Fix results for date/time types, and check SQL_DATA_TYPE in addition to DATA_TYPE

Attachment: bug28657.patch (text/plain), 4.42 KiB.

[26 Jul 2007 14:25] MC Brown
A note has been added to the 3.51.18 changelog: 

DATETIME column types would return FALSE in place of SQL_SUCCESS when requesting the column type information.