64,651
社区成员
发帖
与我相关
我的任务
分享
int mysql_options(MYSQL *connection, enum option_to_set,
const char *argument);
可以让你设定一些选项。比如设定连接超时时间为7秒,可以
unsigned int timeout = 7;
...
connection = mysql_init(NULL);
ret = mysql_options(connection, MYSQL_OPT_CONNECT_TIMEOUT, (const char *)&timeout);
if (ret) {
/* Handle error */
...
}
connection = mysql_real_connect(connection …