测试代码:
#include <iostream> #include <MysqL/MysqL.h> using namespace std; int main() { MysqL_RES *result; MysqL_ROW row; MysqL *connection; MysqL MysqL; int state; MysqL_init(&MysqL); connection = MysqL_real_connect(&MysqL,"ip","db","pw","tb",0); if(connection == NULL){ cout << MysqL_error(&MysqL) << endl; return 0; } else cout << "connect successfully" << endl; state = MysqL_query(connection,"select ip,group_id from ip_group"); if(state != 0){ cout << MysqL_error(connection) << endl; return 0; } else cout << "connect successfully" << endl; }