Date: Wednesday, March 22, 2006 @ 18:28:59
Author: marc
Path: /cvsroot/carob/odbsequoia/src
Modified: connect.cpp (1.16 -> 1.17) inst.hpp (1.3 -> 1.4)
Implemented new LogLevel setting in .ini file (mainly for carob)
-------------+
connect.cpp | 16 ++++++++++++++++
inst.hpp | 1 +
2 files changed, 17 insertions(+)
Index: odbsequoia/src/connect.cpp
diff -u odbsequoia/src/connect.cpp:1.16 odbsequoia/src/connect.cpp:1.17
--- odbsequoia/src/connect.cpp:1.16 Wed Mar 22 16:03:52 2006
+++ odbsequoia/src/connect.cpp Wed Mar 22 18:28:59 2006
@@ -96,27 +96,43 @@
// BTW how could we fail when providing a default value?
// Slurp DSN information from odbc.ini into ConnectionParameters
+
+ /* Server host name/IP address */
if (0 >= SQLGetPrivateProfileString(cdsn, SERVER_INI, "localhost",
temp, MAX_VALUE_LEN, ODBC_INI))
return SQL_ERROR; // TODO: diags. On the other hand it can hardly fail.
std::wstring serverhost = fromString(std::string(temp));
+ /* Port number */
if (0 >= SQLGetPrivateProfileString(cdsn, PORT_INI, "25322",
temp, MAX_VALUE_LEN, ODBC_INI))
return SQL_ERROR; // TODO: diags. On the other hand it can hardly fail.
in_port_t port = atoi(temp);
+ /* Virtual Database name (mandatory, no default) */
if (0 >= SQLGetPrivateProfileString(cdsn, DATABASE_INI, "",
temp, MAX_VALUE_LEN, ODBC_INI))
throw ODBSeqException(L"???", L"'" WIDENMACRO(DATABASE_INI) L"'"
L" parameter not found in .ini file");
std::wstring vdbname = fromString(std::string(temp));
+ /* Prefix for diagnostics/exceptions/warnings coming from the backend */
if (0 >= SQLGetPrivateProfileString(cdsn, BACKEND_IDS_INI,
DEFAULT_BACKEND_IDS_INI,
temp, MAX_VALUE_LEN, ODBC_INI))
return SQL_ERROR; // TODO: diags. On the other hand it can hardly fail.
this->backend_diagids = fromString(std::string(temp));
+ /* Log level (mainly for carob) */
+ if (0 >= SQLGetPrivateProfileString(cdsn, LOG_LEVEL_INI, "DEFAULTLOGLEVEL",
+ temp, MAX_VALUE_LEN, ODBC_INI))
+ return SQL_ERROR; // TODO: diags. On the other hand it can hardly fail.
+ if (0 != std::string(temp).compare("DEFAULTLOGLEVEL"))
+ try {
+ setLogLevel(StringLogLevel(temp));
+ } catch (const std::string& errmsg) { // unknown log level!
+ throw ODBSeqException(L"????", fromString(errmsg));
+ }
+
#if 0 // see above
delete[] cdsn;
Index: odbsequoia/src/inst.hpp
diff -u odbsequoia/src/inst.hpp:1.3 odbsequoia/src/inst.hpp:1.4
--- odbsequoia/src/inst.hpp:1.3 Thu Jan 19 17:39:36 2006
+++ odbsequoia/src/inst.hpp Wed Mar 22 18:28:59 2006
@@ -37,6 +37,7 @@
#define PORT_INI "Port"
#define BACKEND_IDS_INI "BackendIdentifiers"
#define DEFAULT_BACKEND_IDS_INI "[BackendIdentifiers undefined in INI file]"
+#define LOG_LEVEL_INI "Loglevel"
#endif // include only once
_______________________________________________
Carob-commits mailing list
[email protected]
https://forge.continuent.org/mailman/listinfo/carob-commits