[unixODBC-dev] SQLDriverConnectPrompt

Igor Korot ikorot at earthlink.net
Mon Jan 12 23:30:46 GMT 2009


Hi, guys,

-----Original Message-----
>From: Peter Harvey <pharvey at codebydesign.com>
>Sent: Jan 12, 2009 8:38 AM
>To: unixodbc-dev at mailman.unixodbc.org
>Subject: [unixODBC-dev] SQLDriverConnectPrompt
>
>On Monday 12 January 2009 07:22:29 Nick Gorham wrote:
>> Peter Harvey wrote:
>> >I am pretty certain that the DM does not attempt to prompt for a data
>> >source when provided an empty 'in' string to SQLDriverConnect. This is
>> >something that could be added. For example;
>> >
>> >    if ( !conn_str_in )
>> >    {
>> >        /*
>> >         * not quite by the book, but better than nothing
>> >         */
>> >
>> >        conn_str_in = (SQLCHAR*)"DSN=DEFAULT;";
>> >        len_conn_str_in = strlen((char*) conn_str_in );
>> >    }
>> >
>> >
>> >The above code could be altered such that it goes into a UI plugin to
>> >get a data source to use. I could add the following to odbcinst;
>> >
>> >BOOL SQLDriverConnectPrompt( HWND  hWnd,  SQLCHAR *pszChars, SQLSMALLINT
>> >nMaxChars );
>> >
>> >And a corresponding call like this to the UI plugin (odbcinstQ4);
>> >
>> >BOOL ODBCDriverConnectPrompt( HODBCINSTWND  hWnd,  SQLCHAR *pszChars,
>> >SQLSMALLINT nMaxChars );
>> >
>> >--
>> >Peter
>>
>> Ok, I have added the code into the driver manager to call
>> ODBCDriverConnectPrompt in the odbcinstQ lib if needed. So it needs the
>> GUI part adding now to return a selected DSN name in pszChars, and a
>> return of TRUE, or a return of FALSE on error, or no selection of DSN.

Thank you, Nick. However, I don't know about TRUE/FALSE.
I did a quick test with this on Windows and when I hit Escape/click Cancel
from the DSN dialog, it returned SQL_NO_DATA.
So, I'm just thinking that all it needs to do is either return
SQL_SUCCESS when DSN is selected or different errors according to
SQLDriverConnect in MSDN.

>
>
>Ok - thanks Nick! I will add the remaining functionality in unixODBC-GUI-Qt 
>today/tomorrow.

Thank you.

>
>--
>Peter
>_______________________________________________
>unixODBC-dev mailing list
>unixODBC-dev at mailman.unixodbc.org
>http://mailman.unixodbc.org/mailman/listinfo/unixodbc-dev



More information about the unixODBC-dev mailing list