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.\n", my_dbname, my_hostname); 
        use_mysql = 0; 
} else { 
       char value = 1; 
       mysql_options(&logdb, MYSQL_OPT_RECONNECT, (char*)&value); 
        use_mysql = 1; 
}

 

相关文章:

  • 2022-12-23
  • 2021-06-08
  • 2021-08-14
  • 2021-11-17
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-07-19
猜你喜欢
  • 2021-06-07
  • 2021-09-19
  • 2021-06-02
  • 2021-05-24
  • 2021-10-21
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案