Bug #10148 SQLDescribeCol returns datatype 0 for DECIMAL and NUMERIC columns
Submitted: 25 Apr 2005 15:41 Modified: 12 Mar 2007 21:44
Reporter: Ralph Gadsby Email Updates:
Status: Closed Impact on me:
None 
Category:Connector / ODBC Severity:S2 (Serious)
Version:3.51.11 OS:Windows (Windows XP SP1 RedHat ES 3)
Assigned to: Jim Winstead CPU Architecture:Any

[25 Apr 2005 15:41] Ralph Gadsby
Description:
This bug has been reported previous under bug reference #9445.  SQLDescribeCol is returning datatype 0 instead of 3 for decimal type columns (numeric columns should return 2).  I added a responce to this, but no action has been taken since that time.  This bug stops us (Northgate Information Solutions) supporting this database with our programming language, PROIV.

I have replicated this problem on several platforms, including Windows XP and RedHat Linux ES 3.  The MyODBC driver is version 3.51.11 and the RDBMS is version 5.0.3-Beta.  

Attached is a test program that demonstrates the problem compiled on RedHat and Windows (using GCC under Cygwin).  This program will create a table in the database and then insert 20 rows.  The program will then issue the SQLDescribeCol and SQLBindCol and Fetch the rows.

Output from the test function:
 (Linux ES 3.0)]$./pread MySQL root '' create
SQLDescribeCol : return code = 0 StmtHandle = 0x806a5c8 : ColumnNumber = 1 : ColumnName = KEY1 : ColNameMaxSize = 31 : ColNameSize = 4 : SQLDataType = 1 : ColumnSize = 9 : Decimals = 0 : Nullable = 0
SQLDescribeCol : return code = 0 StmtHandle = 0x806a5c8 : ColumnNumber = 2 : ColumnName = DATA1 : ColNameMaxSize = 31 : ColNameSize = 5 : SQLDataType = 1 : ColumnSize = 9 : Decimals = 0 : Nullable = 0
SQLDescribeCol : return code = 0 StmtHandle = 0x806a5c8 : ColumnNumber = 3 : ColumnName = DATA2 : ColNameMaxSize = 31 : ColNameSize = 5 : SQLDataType = 0 : ColumnSize = 7 : Decimals = 2 : Nullable = 0
000000000 000000000 0.00
000000001 000000100 100.00
000000002 000000200 200.00
000000003 000000300 300.00
000000004 000000400 400.00
000000005 000000500 500.00
000000006 000000600 600.00
000000007 000000700 700.00
000000008 000000800 800.00
000000009 000000900 900.00
000000010 000001000 1000.00
000000011 000001100 1100.00
000000012 000001200 1200.00
000000013 000001300 1300.00
000000014 000001400 1400.00
000000015 000001500 1500.00
000000016 000001600 1600.00
000000017 000001700 1700.00
000000018 000001800 1800.00
000000019 000001900 1900.00
Success

How to repeat:
Run the attached program as follows:

pread {system DSN} {db username} {db password} [create]
[25 Apr 2005 15:44] Ralph Gadsby
RedHat test program

Attachment: pread (application/octet-stream, text), 34.31 KiB.

[25 Apr 2005 15:45] Ralph Gadsby
Windows test program

Attachment: pread.exe (application/octet-stream, text), 204.67 KiB.

[25 Apr 2005 19:32] Jorge del Conde
Thanks a lot for your bug report.
[12 Mar 2007 21:44] Jim Winstead
This was fixed with the addition of support for 5.0's new handling of the DECIMAL type in 3.51.12.
[12 Mar 2007 21:44] Jim Winstead
This was fixed with the addition of support for 5.0's new handling of the DECIMAL type in 3.51.12.