[unixODBC-dev] (no subject)

Igor Korot ikorot at earthlink.net
Tue Nov 15 05:19:00 GMT 2005


This is the piece of code I am talking about from the SQLDataSource.c( lines 292-314):
[code]
        memset( buffer, 0, sizeof( buffer ));
        memset( property, 0, sizeof( property ));
        memset( driver, 0, sizeof( driver ));

        SQLGetPrivateProfileString( object, "Driver", "",
                driver, sizeof( driver ), "ODBC.INI" );

        if ( strlen( driver ) > 0 )
        {
            /*
             * Make this return the description from the driver setup, this is
             * the way its done in Windows

            SQLGetPrivateProfileString( driver, "Description", driver,
                property, sizeof( property ), "ODBCINST.INI" );
             */

            /*
             * even though the string is called description, it should 
             * actually be the driver name entry from odbcinst.ini on windows
             * there is no separate Description line
             */
             strcpy( property, driver );
[/code
All we need to do is to uncomment the call to SQLGetPrivateProfileString() from the file "ODBCINST.INI"

Thank you.]
-----Original Message-----
From: Igor Korot <ikorot at earthlink.net>
Sent: Nov 14, 2005 8:42 PM
To: Igor Korot <ikorot at earthlink.net>, Nick Gorham <nick.gorham at easysoft.com>, Development issues and topics for unixODBC <unixodbc-dev at easysoft.com>
Subject: Re: [unixODBC-dev] (no subject)

Also, will it be suficient to change the source code, as described below, and simply issue the "make" command without cleaning all "*.o" files? And will "make install" copy the files over on op of the old installation?

Those questions comes from the UNIX/Linux newbie, so please forgive me if it sounds too lame... ;-)

Thank you.

-----Original Message-----
From: Igor Korot <ikorot at earthlink.net>
Sent: Nov 14, 2005 11:24 PM
To: Nick Gorham <nick.gorham at easysoft.com>, Development issues and topics for unixODBC <unixodbc-dev at easysoft.com>
Subject: Re: [unixODBC-dev] (no subject)

Hi,
I just verified that information. And according to what I am looking for this is inconsistent with what the Microsoft provides.

>From MSDN:

Arguments
EnvironmentHandle 
[Input]
Environment handle. 
Direction 
[Input]
Determines which data source the Driver Manager returns information on. Can be: 
SQL_FETCH_NEXT (to fetch the next data source name in the list), SQL_FETCH_FIRST (to fetch from the beginning of the list), SQL_FETCH_FIRST_USER (to fetch the first user DSN), or SQL_FETCH_FIRST_SYSTEM (to fetch the first system DSN). 

When Direction is set to SQL_FETCH_FIRST, subsequent calls to SQLDataSources with Direction set to SQL_FETCH_NEXT return both user and system DSNs. When Direction is set to SQL_FETCH_FIRST_USER, all subsequent calls to SQLDataSources with Direction set to SQL_FETCH_NEXT return only user DSNs. When Direction is set to SQL_FETCH_FIRST_SYSTEM, all subsequent calls to SQLDataSources with Direction set to SQL_FETCH_NEXT return only system DSNs. 

ServerName 
[Output]
Pointer to a buffer in which to return the data source name. 
BufferLength1 
[Input]
Length of the *ServerName buffer, in characters; this does not need to be longer than SQL_MAX_DSN_LENGTH plus the null-termination character. 
NameLength1Ptr 
[Output]
Pointer to a buffer in which to return the total number of bytes (excluding the null-termination byte) available to return in *ServerName. If the number of bytes available to return is greater than or equal to BufferLength1, the data source name in *ServerName is truncated to BufferLength1 minus the length of a null-termination character. 
Description 
[Output]
Pointer to a buffer in which to return the description of the driver associated with the data source. For example, dBASE or SQL Server. 

This is from the latest MSDN, and I believe that this code was always in that implementation. Now, the correct code is in place for the file "unixODBC/DriverManager/SQLDataSources.c", but it's commented out (lines 301-307 in 2.2.12), and the code that returns the library name with the full path is returned instead (lines 309-314 of the same file).

Could somebody please fix it according to the MSDN, and the commented comments? But maybe somebody did it on purpose? Can anybody clarify that particular piece of code?

I will fix it in my code, and see if it will be consistent with the way MSDN describes it.

Thank you.
-----Original Message-----
From: Nick Gorham <nick.gorham at easysoft.com>
Sent: Nov 7, 2005 2:46 AM
To: Igor Korot <ikorot at earthlink.net>, Development issues and topics for unixODBC <unixodbc-dev at easysoft.com>
Subject: Re: [unixODBC-dev] (no subject)

Igor Korot wrote:

>Hi, ALL,
>I was looking at the unixODBC version 2.2.6, and I found some inconsistency. Hopefully this is already fixed in the 2.2.11, but I want to make sure...
>When I started coding with the 2.2.6, I used the function SQLDataSources(). Because my code run, and I didn't get what I was suppose to, I started looking. The 6th parameter of the function should return the description of the driver in the file odbcinst.ini. With the unixODBC 2.2.6, the function returned the Driver library name.
>
>I just hoped that with the fix of the SQLConfigDataSource() and the ODBCConfig will run successfully I will be able to check this as well. But I hope that somebody already mentined this here, and it's already been fixed.
>
>Thank you.
>_______________________________________________
>unixODBC-dev mailing list
>unixODBC-dev at easysoft.com
>http://mail.easysoft.com/mailman/listinfo/unixodbc-dev
>
>
>  
>
Yes, I think that has now changed, On windows it returns the driver 
name, not the description as such, but the text that could be used in 
the DRIVER= part of a connect string, so I believe the unixODBC version 
is to return the Driver= entry, but to not convert that to the actual 
lib name.

-- 
Nick Gorham
Easysoft Limited




More information about the unixODBC-dev mailing list