Bug #57182 SQLProcedureColumns doesn't work with certain data/parameters combinations
Submitted: 1 Oct 2010 18:47 Modified: 6 Oct 2010 15:49
Reporter: Lawrenty Novitsky Email Updates:
Status: Closed Impact on me:
Category:Connector / ODBC Severity:S3 (Non-critical)
Version:5.1.7 OS:Any
Assigned to: Lawrenty Novitsky CPU Architecture:Any

[1 Oct 2010 18:47] Lawrenty Novitsky
For some data(procedures) and/or parameters combinations SQLProcedureColumns works incorrectly. For example it can return no records for existing procedure with correct parameters supplied.

Also it returns incorrect data for column #7 TYPE_NAME. e.g. it returns "varchar(20)" instead of just "varchar"

How to repeat:
ok_sql(hstmt, "CREATE DEFINER=`adb`@`%` PROCEDURE `proccol_issue`(in id int, in name varchar(20)) "
    "  insert into simp values (id, name);"

  ok_stmt(hstmt, SQLProcedureColumns(hstmt, "test", SQL_NTS, NULL, 0,
    "proccol_issue", SQL_NTS, 
    NULL, 0));

  ok_stmt(hstmt, SQLFetch(hstmt));

SQLFetch will return SQL_NO_DATA.
for 2nd bug change in the existing t_sqlprocedurecolumns testcase TYPE_NAME column examining to:

is_str(my_fetch_str(hstmt, buff, 7), 
           strlen(data_to_check[iter].c07_type_name) + 1);

Suggested fix:
patch will be attached in a minute
[1 Oct 2010 21:31] Lawrenty Novitsky
Patch for the bug

Attachment: bug57182.patch (application/octet-stream, text), 8.46 KiB.

[1 Oct 2010 21:33] Lawrenty Novitsky
while reviewed the patch found couple more bugs. so "minute" was pretty long
patch has been pushed to the trunk as rev#932
[6 Oct 2010 15:49] Tony Bedford
An entry has been added to the 5.1.8 changelog:

For some procedure and parameter combinations SQLProcedureColumns() did not work correctly. For example, it could not return records for an existing procedure with correct parameters supplied.

Further, it returned incorrect data for column 7, TYPE_NAME. For example, it returned VARCHAR(20) instead of VARCHAR.