fixed compile error on linux

This commit is contained in:
fasiondog 2020-09-30 21:56:01 +08:00
parent 49bd1aae15
commit 0cf93e77dd

View File

@ -71,7 +71,7 @@ bool MySQLConnect::ping() {
void MySQLConnect::exec(const string& sql_string) {
HKU_CHECK(m_mysql, "mysql connect is invalid!");
int ret = mysql_query(m_mysql, sql_string.c_str());
if (CR_SERVER_GONE_ERROR == ret) {
if (ret) {
// 尝试重新连接
if (ping()) {
ret = mysql_query(m_mysql, sql_string.c_str());
@ -89,8 +89,9 @@ void MySQLConnect::exec(const string& sql_string) {
do {
MYSQL_RES* result = mysql_store_result(m_mysql);
if (result) {
auto num_fields = mysql_num_fields(result);
HKU_TRACE("num_fields: {}", num_fields);
// auto num_fields = mysql_num_fields(result);
// HKU_TRACE("num_fields: {}", num_fields);
mysql_num_fields(result);
mysql_free_result(result);
} else {
if (mysql_field_count(m_mysql) == 0) {