projects
/
NeonServV5.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge remote-tracking branch 'IOMultiplexer.git/master' into development
[NeonServV5.git]
/
src
/
mysqlConn.c
diff --git
a/src/mysqlConn.c
b/src/mysqlConn.c
index 867af65dccf8014afa546c88f43077d9094ce116..45ab1931dee8766b7e13c9a4a15da6cfa41fd3fc 100644
(file)
--- a/
src/mysqlConn.c
+++ b/
src/mysqlConn.c
@@
-17,6
+17,8
@@
#include "mysqlConn.h"
#include "ConfigParser.h"
#include "mysqlConn.h"
#include "ConfigParser.h"
+#include "tools.h"
+#include "log.h"
#define DATABASE_VERSION "20"
static void show_mysql_error();
#define DATABASE_VERSION "20"
static void show_mysql_error();
@@
-159,7
+161,8
@@
void init_mysql() {
}
}
fclose(f);
}
}
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];
f = fopen("database.defaults.sql", "r");
if (f) {
char line[4096];
@@
-174,7
+177,8
@@
void init_mysql() {
}
}
fclose(f);
}
}
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);
do {
MYSQL_RES *res = mysql_store_result(mysql_conn);
mysql_free_result(res);
@@
-208,7
+212,7
@@
void init_mysql() {
}
fclose(f);
} else
}
fclose(f);
} else
- p
error("database.sql missing!
");
+ p
rintf_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);
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()
static void show_mysql_error() {
MYSQL *mysql_conn = get_mysql_conn();
//show mysql_error()
- p
utlog(LOGLEVEL_ERROR, "MySQL
Error: %s\n", mysql_error(mysql_conn));
+ p
rintf_log("main", LOG_ERROR | LOG_MYSQL, "
Error: %s\n", mysql_error(mysql_conn));
}
void printf_mysql_query(const char *text, ...) {
}
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';
va_end(arg_list);
if (pos < 0 || pos > (MYSQLMAXLEN - 2)) pos = MYSQLMAXLEN - 2;
queryBuf[pos] = '\0';
- p
utlog(LOGLEVEL_MYSQL, "MySQL:
%s\n", queryBuf);
+ p
rintf_log("main", LOG_MYSQL, "
%s\n", queryBuf);
if(mysql_query(mysql_conn, queryBuf)) {
check_mysql();
if(mysql_query(mysql_conn, 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';
va_end(arg_list);
if (pos < 0 || pos > (len - 2)) pos = len - 2;
queryBuf[pos] = '\0';
- p
utlog(LOGLEVEL_MYSQL, "MySQL:
%s\n", queryBuf);
+ p
rintf_log("main", LOG_MYSQL, "
%s\n", queryBuf);
if(mysql_query(mysql_conn, queryBuf)) {
check_mysql();
if(mysql_query(mysql_conn, queryBuf)) {
if(mysql_query(mysql_conn, queryBuf)) {
check_mysql();
if(mysql_query(mysql_conn, queryBuf)) {