|
|
Choosing A Webhost: |
CVS update of odbsequoia/src (connect.cpp inst.hpp): msg#00179db.carob.cvs
Date: Thursday, March 30, 2006 @ 17:23:53 Author: marc Path: /cvsroot/carob/odbsequoia/src Modified: connect.cpp (1.19 -> 1.20) inst.hpp (1.5 -> 1.6) Now looking for "UserName" and "Password" in ini file when arguments are null. Implements ODBSEQ-21. -------------+ connect.cpp | 27 +++++++++++++++++++++++++-- inst.hpp | 2 ++ 2 files changed, 27 insertions(+), 2 deletions(-) Index: odbsequoia/src/connect.cpp diff -u odbsequoia/src/connect.cpp:1.19 odbsequoia/src/connect.cpp:1.20 --- odbsequoia/src/connect.cpp:1.19 Thu Mar 23 00:10:59 2006 +++ odbsequoia/src/connect.cpp Thu Mar 30 17:23:53 2006 @@ -94,6 +94,8 @@ // TODO: call SQLInstallerError() to throw better diags // BTW how could we fail when providing a default value? + + // TODO: write a wrapper function with default arguments // Slurp DSN information from odbc.ini into ConnectionParameters @@ -140,10 +142,31 @@ delete[] cdsn; #endif + /** UserName */ + std::wstring wusername(L""); // default if even SQLGetPr... fails + if (user) + wusername = fromSQLW(user, userlen); + else { // look in INI file + if (0 < SQLGetPrivateProfileString(cdsn, USERNAME_INI , "", + temp, MAX_VALUE_LEN, ODBC_INI)) + wusername = fromString(std::string(temp)); + } + + /** Password */ + std::wstring wpassword(L""); // default if even SQLGetPr... fails + if (pass) + wpassword = fromSQLW(pass, passlen); + else { // look in INI file + if (0 < SQLGetPrivateProfileString(cdsn, PASSWORD_INI, "", + temp, MAX_VALUE_LEN, ODBC_INI)) + wpassword = fromString(std::string(temp)); + } + + /** Connect finally */ CarobNS::ConnectionParameters connectionPrms(serverhost, port, vdbname, - fromSQLW(user, userlen), fromSQLW(pass, passlen), - DEBUG_LEVEL_DEBUG); + wusername, wpassword, + DEBUG_LEVEL_DEBUG); // unused, see CAROB-90 this->carob_conn = new Connection(connectionPrms); // TODO: SQLWarnings -> SUCCESS_WITH_INFO return SQL_SUCCESS; Index: odbsequoia/src/inst.hpp diff -u odbsequoia/src/inst.hpp:1.5 odbsequoia/src/inst.hpp:1.6 --- odbsequoia/src/inst.hpp:1.5 Wed Mar 22 18:50:14 2006 +++ odbsequoia/src/inst.hpp Thu Mar 30 17:23:53 2006 @@ -34,6 +34,8 @@ #define SERVER_INI "Servername" #define DATABASE_INI "Database" +#define USERNAME_INI "UserName" +#define PASSWORD_INI "Password" #define PORT_INI "Port" #define BACKEND_IDS_INI "BackendIdentifiers" #define DEFAULT_BACKEND_IDS_INI "[BackendIdentifiers undefined in INI file]"
|
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | CVS update of odbsequoia/src (util.cpp), marc-Tt5JLJuBijYiZlD9aYmxOGD2FQJk+8+b |
|---|---|
| Next by Date: | CVS update of odbsequoia (odbc.ini), marc-Tt5JLJuBijYiZlD9aYmxOGD2FQJk+8+b |
| Previous by Thread: | CVS update of odbsequoia/src (connect.cpp inst.hpp), marc-Tt5JLJuBijYiZlD9aYmxOGD2FQJk+8+b |
| Next by Thread: | CVS update of odbsequoia/src (inst.hpp), marc-Tt5JLJuBijYiZlD9aYmxOGD2FQJk+8+b |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
Free MagazinesCisco NewsReceive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business. subscribe Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field. subscribe The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business. subscribe Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company. subscribe Total Telecom Total Telecom is "The Economist of the communications industry". subscribe |
Home
| advertise | OSDir is
an inevitable website.
|