Bug #10141 SQLColumns doesn't support ordinal position
Submitted: 25 Apr 2005 10:36 Modified: 12 Dec 2005 14:47
Reporter: Henning Andersen Email Updates:
Status: Closed Impact on me:
None 
Category:Connector / ODBC Severity:S2 (Serious)
Version:3.51.11 OS:Windows (XP)
Assigned to: Bogdan Degtyariov CPU Architecture:Any

[25 Apr 2005 10:36] Henning Andersen
Description:
It seems like SQLColumns doesn't support the ordinal position (index17). 

When working on other databases such as PostGreSQL and Access it works fine, which leads me think that it is a bug in MySQL.

How to repeat:
When calling SQLColumns and binding the column in question:

            rc = SQLBindCol(StmtHandle, 17, SQL_C_SLONG, (SQLPOINTER) 
                     &OrdinalPosition, sizeof(OrdinalPosition), &i17 );

Then in my app the i17 is always: SQL_NULL_DATA for each fetch.
I would have expected that the OrdinalPosition would have the column's sequence number in the table for that particaly column.
[16 May 2005 6:32] Vasily Kishkin
I created test program and tried to repeat the bug. I could't repeat.
There is trace log of my test program:
Connect....
Drop....
Create....
Test....
Bind columns....
Index = 1, Value = 1,Length = 4
Index = 2, Value = 2,Length = 4
Index = 3, Value = 3,Length = 4
Index = 4, Value = 4,Length = 4
Index = 5, Value = 5,Length = 4
Index = 6, Value = 6,Length = 4
Index = 7, Value = 7,Length = 4
Index = 8, Value = 8,Length = 4
Index = 9, Value = 9,Length = 4
Index = 10, Value = 10,Length = 4
Index = 11, Value = 11,Length = 4
Index = 12, Value = 12,Length = 4
Index = 13, Value = 13,Length = 4
Index = 14, Value = 14,Length = 4
Index = 15, Value = 15,Length = 4
Index = 16, Value = 16,Length = 4
Index = 17, Value = 17,Length = 4
Index = 18, Value = 18,Length = 4
Disconnect....
I attached my test program in files section.
[16 May 2005 6:33] Vasily Kishkin
test program of bug # 10141

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

[16 May 2005 18:41] Henning Andersen
Hello,
I've checked the file (test.c) used to reproduce and it doesn's seem to call SQLColumns but it calls SQLExecDirect. I haven't experienced this problem with SQLExecDirect, only with SQLColumns. Maybe that is the reason it wasn't reproduced?

Regards,
Henning
[17 May 2005 5:25] Vasily Kishkin
I could reproduce this bug. Thanks a lot !
Tested on Win 2000 Sp4 , Microsoft Visual C 7.0, MyODBC 3.51.11. Test case is attached (test2.c).
[17 May 2005 5:25] Vasily Kishkin
new test case

Attachment: test2.c (text/plain), 8.74 KiB.

[12 Dec 2005 14:47] Bogdan Degtyariov
Thank you for your bug report. This issue has already been fixed
in the latest released version of that product, which you can download at 
http://www.mysql.com/downloads/

Additional info:

MySQL Connector/ODBC v.3.51.12 contains a fix for this bug