From 2f06d65c566acaeabce9ccd96f2374c03be30235 Mon Sep 17 00:00:00 2001 From: pk910 Date: Sun, 14 Aug 2011 19:30:53 +0200 Subject: [PATCH] added debug output --- ClientSocket.c | 1 + mysqlConn.c | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/ClientSocket.c b/ClientSocket.c index 78467a1..59f272a 100644 --- a/ClientSocket.c +++ b/ClientSocket.c @@ -33,6 +33,7 @@ struct ClientSocket* create_socket(char *host, int port, char *pass, struct User } client->host = strdup(host); client->port = port; + printf("Connect: %s:%d", client->host, client->port); client->pass = (pass == NULL ? NULL : strdup(pass)); client->user = user; client->flags = 0; diff --git a/mysqlConn.c b/mysqlConn.c index fe207a7..9f2ba7f 100644 --- a/mysqlConn.c +++ b/mysqlConn.c @@ -53,6 +53,7 @@ void init_mysql() { mysql_conn = mysql_init(NULL); if (!mysql_real_connect(mysql_conn, MYSQL_HOST, MYSQL_USER, MYSQL_PASS, MYSQL_BASE, MYSQL_PORT, NULL, 0)) { //error + show_mysql_error(); } } @@ -62,7 +63,7 @@ void free_mysql() { void show_mysql_error() { //show mysql_error() - + printf("MySQL Error: %s\n", mysql_error(mysql_conn)); } void printf_mysql_query(const char *text, ...) { @@ -75,6 +76,7 @@ void printf_mysql_query(const char *text, ...) { va_end(arg_list); if (pos < 0 || pos > (MYSQLMAXLEN - 2)) pos = MYSQLMAXLEN - 2; queryBuf[pos] = '\0'; + printf("MySQL: %s\n", queryBuf); if(mysql_query(mysql_conn, queryBuf)) { show_mysql_error(); } -- 2.20.1