|
|
Choosing A Webhost: |
CVS update of odbsequoia/src (connect.cpp): msg#00115db.carob.cvs
Date: Wednesday, March 22, 2006 @ 15:35:04 Author: marc Path: /cvsroot/carob/odbsequoia/src Modified: connect.cpp (1.14 -> 1.15) Now throwing a proper exception when DATABASE parameter is missing from .ini file -------------+ connect.cpp | 18 +++++++++++++----- 1 files changed, 13 insertions(+), 5 deletions(-) Index: odbsequoia/src/connect.cpp diff -u odbsequoia/src/connect.cpp:1.14 odbsequoia/src/connect.cpp:1.15 --- odbsequoia/src/connect.cpp:1.14 Fri Feb 24 15:55:45 2006 +++ odbsequoia/src/connect.cpp Wed Mar 22 15:35:04 2006 @@ -22,12 +22,13 @@ #include "stmt.hpp" #include "util.hpp" +#include "odbc_exception.hpp" #include "inst.hpp" #include "Connection.hpp" #include "ConnectionParameters.hpp" -#include "CarobException.hpp" #include "StringCodecs.hpp" +#include "Common.hpp" // setLogLevel() #include <odbcinst.h> @@ -87,20 +88,27 @@ LPCSTR cdsn = narrow_dsn.c_str(); #endif + // The trick: providing a zero-length default value is like + // providing NO default value. Now we can throw an SQL_ERROR + // when we require the user to provide a value. + + // TODO: call SQLInstallerError() to throw better diags + // Slurp DSN information from odbc.ini into ConnectionParameters if (!SQLGetPrivateProfileString(cdsn, SERVER_INI, "localhost", temp, MAX_VALUE_LEN, ODBC_INI)) - return SQL_ERROR; // TODO: diags + return SQL_ERROR; // TODO: diags. On the other hand it can hardly fail. std::wstring serverhost = fromString(std::string(temp)); if (!SQLGetPrivateProfileString(cdsn, PORT_INI, "25322", temp, MAX_VALUE_LEN, ODBC_INI)) - return SQL_ERROR; // TODO: diags + return SQL_ERROR; // TODO: diags. On the other hand it can hardly fail. in_port_t port = atoi(temp); if (!SQLGetPrivateProfileString(cdsn, DATABASE_INI, "", temp, MAX_VALUE_LEN, ODBC_INI)) - return SQL_ERROR; // TODO: diags + throw ODBSeqException(L"???", L"'" WIDENMACRO(DATABASE_INI) L"'" + L" parameter not found in .ini file"); std::wstring vdbname = fromString(std::string(temp)); if (!SQLGetPrivateProfileString(cdsn, BACKEND_IDS_INI, DEFAULT_BACKEND_IDS_INI, @@ -109,7 +117,7 @@ this->backend_diagids = fromString(std::string(temp)); -#if 0 +#if 0 // see above delete[] cdsn; #endif
|
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | CVS update of carob/include (Common.hpp), marc-Tt5JLJuBijYiZlD9aYmxOGD2FQJk+8+b |
|---|---|
| Next by Date: | CVS update of odbsequoia/src (connect.cpp), marc-Tt5JLJuBijYiZlD9aYmxOGD2FQJk+8+b |
| Previous by Thread: | CVS update of carob/include (ParameterStatement.hpp), marc-Tt5JLJuBijYiZlD9aYmxOGD2FQJk+8+b |
| Next by Thread: | CVS update of odbsequoia/src (connect.cpp), 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.
|