[unixODBC-support] SQLGetDiagRec bug

Nick Gorham nick.gorham at easysoft.com
Wed Nov 8 15:55:37 GMT 2006


Ian Ashley wrote:

>Dear Nick and friends,
>
>I think that a bug has been introduced to SQLGetDiagRec somewhere between
>the 2.2.10 and 2.2.12 releases. All the error messages seem to get returned
>twice.
>
>The problem is demonstrated by modifying isql.c as shown below that and then
>trying to execute an invalid statement. For example
>
>select invalid_column from invalid_table
>
>  
>
Ok, edit DriverManager/SQLGetDiagRec.c

look for

        if ( rec_number <= head -> sql_diag_head.internal_count +
            head -> sql_diag_head.error_count )
        {
            rec_number -= head -> sql_diag_head.internal_count;
        }
        else
        {
            rec_number -= ( head -> sql_diag_head.internal_count + head 
-> sql_diag_head.error_count );
        }

And replace with

        rec_number -= head -> sql_diag_head.internal_count;

-- 
Nick Gorham
Easysoft Limited
http://www.easysoft.com, http://www.unixODBC.org




More information about the unixODBC-support mailing list