MYSQL篇
新增如果unique索引字段重复,则更新;
insert into mg_user(key,key2,key3)value('value','value2','value3') on duplicate key update key=value,key2=value2,key3=value3
show global variables;
if(!mysql_real_connect(&logdb, my_hostname, my_user, my_password, my_dbname, my_port, my_sock, 0)){ //mysql长连接
ast_log(LOG_ERROR, "Failed to connect to mysql database %s on %s.
", my_dbname, my_hostname);
use_mysql = 0;
} else {
char value = 1;
mysql_options(&logdb, MYSQL_OPT_RECONNECT, (char*)&value);
use_mysql = 1;
}