[unixODBC-support] Problem with SQLDrivers()

Bruce A. Mallett bam at NightStorm.com
Sun Jul 17 02:24:30 BST 2005


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?


      - Bruce

More information about the unixODBC-support mailing list