[unixODBC-support] Problem with SQLDrivers()

Nick Gorham nick.gorham at easysoft.com
Sun Jul 17 10:12:11 BST 2005


Bruce A. Mallett wrote:

> Hello,
>
> I'm using 2.2.10 under SuSE 9.3 and discovered that the last parameter 
> to SQLDrivers (pcbDrvrAttr), which is supposed to be an output, is not 
> getting filled in even when the attribute buffer is being returned 
> with data.  In examining DriverManager/SQLDrivers.c I see the 
> following code on or about line 413:
>
>                if ( *pcb_drvr_attr )
>                {
>                    *pcb_drvr_attr = total_len;
>                }
>
> This code is explicitly testing to see if the value into which the 
> length is to be written is non-zero.  Only if it is non-zero will the 
> length be returned.  Dropping the asterisk within the "if ()" would 
> make sense (and perhaps is what was meant), otherwise this implies 
> that this parameter is both an input and an output .. something that 
> differs from the API description.  I just checked in 2.2.11 and the 
> code is the same.
>
> When I changed my code to explicitly set a non-zero value into the 
> last parameter prior to the SQLDrivers() call I found that I do get a 
> value returned as expected.
>
> Bug or am I misreading something?


No, looks like a bug to me.

I will change it in CVS.

Thanks.

-- 
Nick



More information about the unixODBC-support mailing list