Date: Friday, March 31, 2006 @ 00:57:55
  Author: marc
    Path: /cvsroot/carob/odbsequoia

Modified: odbc.ini (1.4 -> 1.5) odbcinst.ini (1.3 -> 1.4) src/connect.cpp
          (1.23 -> 1.24) src/env.cpp (1.13 -> 1.14) src/inst.hpp (1.7 ->
          1.8)

Moved global LogLevel setting from odbc.ini to odbcinst.ini


-----------------+
 odbc.ini        |    1 -
 odbcinst.ini    |    1 +
 src/connect.cpp |   14 --------------
 src/env.cpp     |   18 ++++++++++++++++++
 src/inst.hpp    |    2 +-
 5 files changed, 20 insertions(+), 16 deletions(-)


Index: odbsequoia/odbc.ini
diff -u odbsequoia/odbc.ini:1.4 odbsequoia/odbc.ini:1.5
--- odbsequoia/odbc.ini:1.4     Thu Mar 30 18:38:59 2006
+++ odbsequoia/odbc.ini Fri Mar 31 00:57:55 2006
@@ -23,4 +23,3 @@
 Password               = 
 Port           = 25322
 BackendIdentifiers = [postgresql.org][PG]
-LogLevel               = DEBUG
Index: odbsequoia/odbcinst.ini
diff -u odbsequoia/odbcinst.ini:1.3 odbsequoia/odbcinst.ini:1.4
--- odbsequoia/odbcinst.ini:1.3 Thu Mar 30 21:23:52 2006
+++ odbsequoia/odbcinst.ini     Fri Mar 31 00:57:55 2006
@@ -5,3 +5,4 @@
 CommLog = 1
 FileUsage = 1
 #FakeODBC2 = false (default = true)
+LogLevel               = DEBUG
Index: odbsequoia/src/connect.cpp
diff -u odbsequoia/src/connect.cpp:1.23 odbsequoia/src/connect.cpp:1.24
--- odbsequoia/src/connect.cpp:1.23     Thu Mar 30 23:36:33 2006
+++ odbsequoia/src/connect.cpp  Fri Mar 31 00:57:55 2006
@@ -28,7 +28,6 @@
 #include "Connection.hpp"
 #include "ConnectionParameters.hpp"
 #include "StringCodecs.hpp"
-#include "Common.hpp" // setLogLevel()
 
 #include <cstdlib> // for atoi()
 
@@ -125,19 +124,6 @@
         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) TODO: move this to inst.ini/Env ctor */
-    if (0 > SQLGetPrivateProfileString(cdsn, LOG_LEVEL_INI, 
"DEFAULTCAROBLOGLEVEL",
-                                        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("DEFAULTCAROBLOGLEVEL"))
-        try {
-            setLogLevel(StringLogLevel(temp));
-        } catch (const std::string& errmsg) { // unknown log level!
-            throw ODBSeqException(L"08001", fromString(errmsg)
-                                  + L", check " WIDENMACRO(LOG_LEVEL_INI)
-                                  + L" setting");
-        }
-
 
 #if 0 // see above
     delete[] cdsn;
Index: odbsequoia/src/env.cpp
diff -u odbsequoia/src/env.cpp:1.13 odbsequoia/src/env.cpp:1.14
--- odbsequoia/src/env.cpp:1.13 Fri Mar 31 00:44:15 2006
+++ odbsequoia/src/env.cpp      Fri Mar 31 00:57:55 2006
@@ -25,6 +25,7 @@
 #include "odbc_exception.hpp"
 #include "inst.hpp"
 
+#include "StringCodecs.hpp"
 #include "Common.hpp" // for the logger
 
 #include <sql.h>
@@ -59,6 +60,23 @@
         fake_version2 = true;
 
 
+    /* Log level (mainly for carob) */
+    if (0 > SQLGetPrivateProfileString(MYDRIVER_NAME_INST_INI, 
LOG_LEVEL_INST_INI,
+                                       "DEFAULTCAROBLOGLEVEL",
+                                       temp, MAX_VALUE_LEN, ODBCINST_INI))
+        // How could this fail ?
+        throw ODBSeqException(L"HY000",
+                              L"Error while searching " 
WIDENMACRO(LOG_LEVEL_INST_INI) L" key");
+
+    if (0 != std::string(temp).compare("DEFAULTCAROBLOGLEVEL"))
+        try {
+            CarobNS::setLogLevel(CarobNS::StringLogLevel(temp));
+        } catch (const std::string& errmsg) { // unknown log level!
+            throw ODBSeqException(L"08001", CarobNS::fromString(errmsg)
+                                  + L", check " WIDENMACRO(LOG_LEVEL_INST_INI)
+                                  + L" setting");
+        }
+
     isInitialized = true;
 
     return ret;
Index: odbsequoia/src/inst.hpp
diff -u odbsequoia/src/inst.hpp:1.7 odbsequoia/src/inst.hpp:1.8
--- odbsequoia/src/inst.hpp:1.7 Thu Mar 30 21:23:52 2006
+++ odbsequoia/src/inst.hpp     Fri Mar 31 00:57:55 2006
@@ -36,6 +36,7 @@
 #endif
 
 #define MYDRIVER_NAME_INST_INI "Sequoia"
+#define LOG_LEVEL_INST_INI "LogLevel"
 
 
 // unixODBC 2.2 SQLGetPrivateProfileString() tips:
@@ -78,7 +79,6 @@
 #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

Reply via email to