Bug #16224 | Calling SQLGetDiagField with RecNumber 0,DiagIdentifier NOT 0 returns SQL_ERROR | ||
---|---|---|---|
Submitted: | 5 Jan 2006 13:32 | Modified: | 6 Jul 2007 2:40 |
Reporter: | tom hindle | Email Updates: | |
Status: | Closed | Impact on me: | |
Category: | Connector / ODBC | Severity: | S3 (Non-critical) |
Version: | 3.51.12 | OS: | IBM AIX (aix 64 5.2) |
Assigned to: | Jess Balint | CPU Architecture: | Any |
[5 Jan 2006 13:32]
tom hindle
[9 Jan 2006 12:00]
Vasily Kishkin
Sorry...I was not able to reproduce the bug. Could you please create and attach some test case ?
[9 Jan 2006 13:54]
tom hindle
a Sample functions demonstrating this problem. /* call this method to get the number of status records that are available for the specified handle.*/ /* int CheckError(SQLHANDLE handle){ SQLINTEGER diagnum=-1; int htype=SQL_HANDLE_ENV; /* this call will always return SQL_ERROR even though its a valid thing to do*/ SQLGetDiagField((SQLSMALLINT)htype,handle, 0,SQL_DIAG_NUMBER,&diagnum,SQL_IS_INTEGER,NULL); return(diagnum); }
[13 Jul 2006 9:56]
Sveta Smirnova
test case
Attachment: bug16224.c (text/plain), 818 bytes.
[13 Jul 2006 18:27]
Sveta Smirnova
Thank you for the report. Verified using attached test case as described on Windows XP SP2 и Solaris 10.
[19 Jun 2007 19:01]
Jess Balint
patch + test
Attachment: bug16224.diff (application/octet-stream, text), 1.26 KiB.
[19 Jun 2007 19:11]
Jim Winstead
A more concise test (no need to alloc your own handles): DECLARE_TEST(t_bug16624) { SQLINTEGER diagcnt; expect_sql(hstmt, "This is an invalid Query! (odbc test)", SQL_ERROR); ok_stmt(hstmt, SQLGetDiagField(SQL_HANDLE_STMT, hstmt, 0, SQL_DIAG_NUMBER, &diagcnt, SQL_IS_INTEGER, NULL)); is_num(diagcnt, 1); return OK; }
[19 Jun 2007 19:12]
Jim Winstead
the test needs a header, too: /** Bug #16224: Calling SQLGetDiagField with RecNumber 0,DiagIdentifier NOT 0 returns SQL_ERROR */
[6 Jul 2007 2:40]
Paul DuBois
Noted in 3.51.17 changelog. Calling SQLGetDiagField with RecNumber 0, DiagIdentifier NOT 0 returned SQL_ERROR, preventing access to diagnostic header fields.