Bug #30918 Corrections/cleanups needed for SQLGetTypeInfo()
Submitted: 8 Sep 2007 18:36 Modified: 14 Mar 2008 18:36
Reporter: Kent Boortz Email Updates:
Status: Closed Impact on me:
None 
Category:Connector / ODBC Severity:S3 (Non-critical)
Version:3.51.20 OS:Any
Assigned to: Jim Winstead
Triage: D3 (Medium)

[8 Sep 2007 18:36] Kent Boortz
Description:
Looking at old reports about problems with the MySQL ODBC
driver and wxWidgets, and reviewing the source for
SQLGetTypeInfo() in "driver/info.c", it looks like it could
need a cleanup. I tried do some cleanup, but it needs more
work from someone with deeper knowledge about ODBC and the
MySQL data types.

Attached to this bug report is a start of a cleanup of the
table that is the base for this functions current implemen-
tation. The definition and examples I used are at

  http://msdn2.microsoft.com/en-us/library/ms714632.aspx
  http://msdn2.microsoft.com/en-us/library/ms715410.aspx

The changes compared to the current 3.51.20 version are

 - Removed ending whitespace in "binary large object (0-255) "
 - Removed "bit auto_increment", BIT is not numeric.
 - Set NULL for UNSIGNED_ATTRIBUTE as BIT as not numeric
 - Set NULL for other non numeric types where no value applies
 - Set NULL for types where auto increment doesn't apply
 - Changed NUM_PREC_RADIX for "double" from 2 to 10

Note that the attached table is for v3 only, a separate
one or some handling of ODBC v2 is also needed.

Some questions I could not answer are

 - Is it correct that all char types marked as case insensitive?
 - There are have two columns with "double", different SQL_*, is that ok?
 - Does MySQL have "interval" types that should be added?
 - Should there be separate "types" for auto increment, separate rows?
 - Are there other types missing?
 - What does the COLUMN_SIZE "precision" really mean, and when can it be NULL?
 - How can the same DATA_TYPE be used but different COLUMN_SIZE?

How to repeat:
You need to review the source for this function.

Suggested fix:
A review and correction of this table, or maybe
let the server somehow tell the driver what it
can support? Some types has changed from MySQL 4.1
to 5.x, so having a static table is a bit tricky.
[8 Sep 2007 18:37] Kent Boortz
The modified table for the SQLGetTypeInfo() implementation

Attachment: part-of-info-h.txt (text/plain), 11.86 KiB.

[29 Feb 2008 19:30] Jim Winstead
Clean up some of the data returned by SQLGetTypeInfo()

Attachment: bug30918.diff (text/plain), 10.15 KiB.

[13 Mar 2008 16:32] Jim Winstead
Committed, will be included in 3.51.24.
[14 Mar 2008 18:36] MC Brown
No documentation required.