X-Git-Url: http://git.pk910.de/?p=NeonServV5.git;a=blobdiff_plain;f=src%2FmysqlConn.c;h=45ab1931dee8766b7e13c9a4a15da6cfa41fd3fc;hp=867af65dccf8014afa546c88f43077d9094ce116;hb=f6bdc9d0fc8db22c265918f3325e11177fd001b9;hpb=8ce78bf760720d04385821abba8f888b5de03140 diff --git a/src/mysqlConn.c b/src/mysqlConn.c index 867af65..45ab193 100644 --- a/src/mysqlConn.c +++ b/src/mysqlConn.c @@ -17,6 +17,8 @@ #include "mysqlConn.h" #include "ConfigParser.h" +#include "tools.h" +#include "log.h" #define DATABASE_VERSION "20" static void show_mysql_error(); @@ -159,7 +161,8 @@ void init_mysql() { } } fclose(f); - } + } else + printf_log("main", LOG_ERROR | LOG_MYSQL, "File not found: database.sql"); f = fopen("database.defaults.sql", "r"); if (f) { char line[4096]; @@ -174,7 +177,8 @@ void init_mysql() { } } fclose(f); - } + } else + printf_log("main", LOG_ERROR | LOG_MYSQL, "File not found: database.defaults.sql"); do { MYSQL_RES *res = mysql_store_result(mysql_conn); mysql_free_result(res); @@ -208,7 +212,7 @@ void init_mysql() { } fclose(f); } else - perror("database.sql missing!"); + printf_log("main", LOG_ERROR | LOG_MYSQL, "File not found: database.upgrade.sql"); do { MYSQL_RES *res = mysql_store_result(mysql_conn); mysql_free_result(res); @@ -231,7 +235,7 @@ void free_mysql() { static void show_mysql_error() { MYSQL *mysql_conn = get_mysql_conn(); //show mysql_error() - putlog(LOGLEVEL_ERROR, "MySQL Error: %s\n", mysql_error(mysql_conn)); + printf_log("main", LOG_ERROR | LOG_MYSQL, "Error: %s\n", mysql_error(mysql_conn)); } void printf_mysql_query(const char *text, ...) { @@ -245,7 +249,7 @@ void printf_mysql_query(const char *text, ...) { va_end(arg_list); if (pos < 0 || pos > (MYSQLMAXLEN - 2)) pos = MYSQLMAXLEN - 2; queryBuf[pos] = '\0'; - putlog(LOGLEVEL_MYSQL, "MySQL: %s\n", queryBuf); + printf_log("main", LOG_MYSQL, "%s\n", queryBuf); if(mysql_query(mysql_conn, queryBuf)) { check_mysql(); if(mysql_query(mysql_conn, queryBuf)) { @@ -265,7 +269,7 @@ void printf_long_mysql_query(int len, const char *text, ...) { va_end(arg_list); if (pos < 0 || pos > (len - 2)) pos = len - 2; queryBuf[pos] = '\0'; - putlog(LOGLEVEL_MYSQL, "MySQL: %s\n", queryBuf); + printf_log("main", LOG_MYSQL, "%s\n", queryBuf); if(mysql_query(mysql_conn, queryBuf)) { check_mysql(); if(mysql_query(mysql_conn, queryBuf)) {