现在,当我编译时,我收到:
/usr/include/mysql/mysql.h:452: error: too many arguments to function int mysql_query(MYSQL*, const char*)
的论点是否有限制,mysql.h
如果有,我该如何解决?
#include <mysql/mysql.h>
string unknown = "Unknown";
MYSQL *conn;
conn = mysql_init(NULL);
mysql_real_connect(conn, "localhost", "root", "password", "alert", 0, NULL, 0);
mysql_query(conn, "INSERT INTO alert_tbl (alert_srcip, alert_country, alert_destip, alert_desthost, alert_destport, alert_bl) VALUES ('%s','%s','%s','%s','%s','%s')", src_ip,country_code,dest_ip,unknown,dest_prt,blip);
mysql_close(conn);
g++ test.c -o test -lstdc++ -I/usr/include/mysql -L/usr/lib/mysql -lmysqlclient