Bug #56717 | SQLDescribeCol and SQLColAttribute cannot be called before SQLExecute | ||
---|---|---|---|
Submitted: | 10 Sep 2010 16:20 | Modified: | 16 Sep 2010 16:46 |
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 |
[10 Sep 2010 16:20]
Lawrenty Novitsky
[13 Sep 2010 17:40]
Lawrenty Novitsky
didn't push as i'm not sure we really need that
[13 Sep 2010 17:40]
Lawrenty Novitsky
the patch
Attachment: bug56717.diff (text/x-diff), 3.90 KiB.
[15 Sep 2010 9:26]
Bogdan Degtyariov
Lawrin, The patch looks ok, but I would like to extend the test case by adding checking the number of result cols (SQLNumResultCols()) after SQLDescribeCol() to fit the real life example. Also, verifying data after reading looks logical: ....... is_str(colname, "tt_varchar", 11); is_num(collen, 128); /* Just to make sure that SQLNumResultCols still works fine */ ok_stmt(hstmt, SQLNumResultCols(hstmt, &colCount)); is_num(colCount, 1); ok_stmt(hstmt, SQLBindParameter(hstmt, 1, SQL_PARAM_INPUT, SQL_C_LONG, SQL_INTEGER, 0, 0, &nData, 0, NULL)); ok_stmt(hstmt, SQLBindCol(hstmt, 1, SQL_C_CHAR, szData, sizeof(szData), NULL)); ok_stmt(hstmt, SQLExecute(hstmt)); ok_stmt(hstmt, SQLFetch(hstmt)); is_str(szData, "string 3", 8); ok_stmt(hstmt, SQLFetch(hstmt)); is_str(szData, "string 4", 8); /* Closing statement and preparing query again to make sure that query isn't "dummy-executed"*/ ok_stmt(hstmt, SQLFreeStmt(hstmt, SQL_CLOSE)); ....
[16 Sep 2010 11:28]
Lawrenty Novitsky
Patch with requested modifications and ChangeLog entries has been pushed as rev#929 If stars align properly it will be released in 5.1.8
[16 Sep 2010 12:27]
Lawrenty Novitsky
final variant of the patch
Attachment: bug56717v2.diff (text/x-diff), 4.48 KiB.
[16 Sep 2010 16:46]
Tony Bedford
An entry has been added to the 5.1.8 changelog: SQLDescribeCol and SQLColAttribute could not be called before SQLExecute, if the query was parameterized and not all parameters were bound. Note, MSDN states that “For performance reasons, an application should not call SQLColAttribute/SQLDescribeCol before executing a statement.” However, it should still be possible to do so if performance reasons are not paramount.