Bug #14149 MyODBC 3.51 driver and SQLTables call. Column truncation on the call
Submitted: 19 Oct 2005 19:00 Modified: 15 Dec 2005 16:13
Reporter: Matt Walton Email Updates:
Status: Can't repeat Impact on me:
None 
Category:Connector / ODBC Severity:S3 (Non-critical)
Version:MyODBC-3.51.11-2-win OS:Windows (Windows 2000 SP4)
Assigned to: Sergey Vlasenko CPU Architecture:Any

[19 Oct 2005 19:00] Matt Walton
Description:
When calling SQLTables with the ODBC driver on Windows I notice that there is a truncation on the first two columns of the result set.  This seems to be due to the fact that the driver incorrectly describes the column (SQLDescribeCol) length as 0.

How to repeat:
Using Microsoft's ODBC Test tool (odbcte32.exe).  use the 2.0 menu options.

1.  full connect with Microsoft's ODBC Test tool (odbcte32.exe)

2.  Go to Catalog menu option

3.  Choose SQLTables and then OK.  This should return SQL Success

4.  Go to Results and choose.  Get Data All.

You'll see results similar to this:

TRUNC: "", "", "trans_date_lw_ly", "TABLE", "MySQL table"
TRUNC: "", "", "trans_date_mtd", "TABLE", "MySQL table"
TRUNC: "", "", "trans_month_ly", "TABLE", "MySQL table"
TRUNC: "", "", "trans_quarter_ly", "TABLE", "MySQL table"

Notice there is truncation taking place.  This is happening due to a bug with the driver.

5.  Back to ODBC Test tool

6.  Run the SQLTables call again.

7.  Go to Results and choose SQLDescribeCol and column number 1.  Click OK.

8.  You'll see from the results that the SQLDescribeCOL for column 1 (TABLE_CAT) shows a size of 0 which is not correct.  This also happens for column 2 (TABLE_SCHEM) and leads to the truncation we see in step 4.  If you try this with other ODBC drivers (like the MSFT SQL Server driver), you'll not see the truncation on the SQLTAbles call and you'll not see a reported length of 0 for the two columns. 

Suggested fix:
To work around this I enabled the NO Catalog option for Flag 3.  This will not show truncation since the driver does not try to return catalog information.
[15 Dec 2005 16:12] Sergey Vlasenko
Log of odbc test tool

Attachment: 14149.log (application/octet-stream, text), 2.12 KiB.

[15 Dec 2005 16:13] Sergey Vlasenko
Can not reproduce behavior on 3.51.12 - output of odbc test tool is attached to this bug.