added debug output
authorpk910 <philipp@zoelle1.de>
Sun, 14 Aug 2011 17:30:53 +0000 (19:30 +0200)
committerpk910 <philipp@zoelle1.de>
Sun, 14 Aug 2011 19:27:46 +0000 (21:27 +0200)
ClientSocket.c
mysqlConn.c

index 78467a1c94b5d1d725d216ed4f57e261d6a4706e..59f272a2fbd11a3fbe92db7825c24cc86f6ba0ec 100644 (file)
@@ -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;
index fe207a797c7eccd18c116c365150fe477ca92ec2..9f2ba7f6016a0e59de332fa454398d09842a8b9d 100644 (file)
@@ -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();
     }