[unixODBC-support] odbcinst data source query bug

Andy Salnikov a_salnikov at yahoo.com
Fri Jan 23 15:26:03 GMT 2009


[Sorry for double post, my previous message did not seem to make it to 
the list,
disregard if you get it twice.]

Hi,

I have just discovered an issue in odbcinst application. When trying
to query the parameters of the data source I got a garbled output from it.
Here is the example:

% odbcinst -q -s -n IRODS_ICAT
[IRODS_ICAT]
Description=MySQL IRODS
Driver=MySQL
Server=server-host
Port=Database=IRODS_ICAT
Socket=Option=Stmt=

Note the two last lines.

Checking the source it looks like the new line is only printed when there
is a value for the parameter:

 346           while( *ptr )
 347           {
 348               printf( "%s=", ptr );
 349               if ( SQLGetPrivateProfileString( pszDSN, ptr, "", zValue, sizeof( szValue ) - 1, "ODBC.INI" ) > 0 )
 350               {
 351                   printf( "%s\n", szValue );
 352               }
 353               ptr += strlen( ptr ) + 1;
 354           }

which should be correctly written as:

 346           while( *ptr )
 347           {
 348               printf( "%s=", ptr );
 349               if ( SQLGetPrivateProfileString( pszDSN, ptr, "", szValue, sizeof( szValue ) - 1, "ODBC.INI" ) > 0 )
 350               {
 351                   printf( "%s", szValue );
 352               }
 353               printf( "\n" );
 354               ptr += strlen( ptr ) + 1;
 355           }

This was in version 2.2.12, but I checked the most recent 2.2.14 and it 
seems that
the bug is still there. Would be nice to have it fixed eventually.

Andy.






More information about the unixODBC-support mailing list