}
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;
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();
}
}
void show_mysql_error() {
//show mysql_error()
-
+ printf("MySQL Error: %s\n", mysql_error(mysql_conn));
}
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();
}