Date: Wednesday, July 12, 2006 @ 15:07:24
Author: csaba
Path: /cvsroot/carob/libmysequoia/src
Modified: MySQLAPI.cpp (1.59 -> 1.60)
Read the log file from the user home directory if exists. Fixes for LMS-17
--------------+
MySQLAPI.cpp | 53 ++++++++++++++++++++++++-----------------------------
1 files changed, 24 insertions(+), 29 deletions(-)
Index: libmysequoia/src/MySQLAPI.cpp
diff -u libmysequoia/src/MySQLAPI.cpp:1.59 libmysequoia/src/MySQLAPI.cpp:1.60
--- libmysequoia/src/MySQLAPI.cpp:1.59 Thu Jun 29 17:13:10 2006
+++ libmysequoia/src/MySQLAPI.cpp Wed Jul 12 15:07:24 2006
@@ -44,6 +44,7 @@
#include <cstdlib>
#include <string>
+#include <fstream>
using namespace log4cxx;
using namespace log4cxx::helpers;
@@ -154,20 +155,34 @@
{
library_init.lock();
- char *conf_dir = getenv("LIBMYSEQUOIA_CONF_DIR");
-
+ char *conf_dir = getenv("LIBMYSEQUOIA_CONF_DIR");
+ char *home_dir = getenv("HOME");
+ bool found = false;
+ std::string s;
+
// initialize logging
- if (conf_dir)
+ if (home_dir && !found)
{
- std::string s = std::string(conf_dir) + "/" + LOGGER_CONFIG_FILE;
-
- PropertyConfigurator::configure(s.c_str());
+ s = std::string(home_dir) + "/." + LOGGER_CONFIG_FILE;
+ std::ifstream f(s.c_str());
+ if (f)
+ found = true;
}
- else
+
+ if (conf_dir && !found)
{
- PropertyConfigurator::configure(DEFAULT_LOGGER_CONFIG_FILE);
+ s = std::string(conf_dir) + "/" + LOGGER_CONFIG_FILE;
+ std::ifstream f(s.c_str());
+ if (f)
+ found = true;
}
+ if (!found)
+ s = std::string(DEFAULT_LOGGER_CONFIG_FILE);
+
+ PropertyConfigurator::configure(s.c_str());
+
+
LOG4CXX_DEBUG(logger, "Entering mysql_server_init: argc=" << argc << "
argv=" << argv << " groups=" << groups);
CarobNS::setLogLevel(CarobNS::LOG_LEVEL_OFF);
@@ -831,27 +846,7 @@
{
LOG4CXX_DEBUG(logger, "Entering mysql_warning_count: mysql=" << mysql);
- // TODO implementation
- unsigned int result = 0;
-
-/*
- * commenting out because are not allways working
- *
- MYSQL_RES *res;
- MYSQL_ROW row;
-
- if (mysql_query(mysql, "select @@warning_count") == 0)
- {
- if ((res = mysql_store_result(mysql)))
- {
- if ((row = mysql_fetch_row(res)))
- {
- result = atoi(row[0]);
- }
- }
- mysql_free_result(res);
- }
-*/
+ unsigned int result = mysql ? mysql->warning_count : 0;
LOG4CXX_DEBUG(logger, "Leaving mysql_warning_count: result=" << result);
return result;
_______________________________________________
Carob-commits mailing list
[email protected]
https://forge.continuent.org/mailman/listinfo/carob-commits