修改连接超时时间为2s

This commit is contained in:
luoliangyi 2022-12-26 14:33:14 +08:00
parent dcc86888b2
commit 57d21beb27
1 changed files with 4 additions and 1 deletions

View File

@ -86,6 +86,9 @@ HGResult HGPdtToolDbUserMgrImpl::Create(const HGChar* host, HGUShort port, const
return HGBASE_ERR_FAIL; return HGBASE_ERR_FAIL;
} }
unsigned int timeout = 2;
mysql_options(sql, MYSQL_OPT_CONNECT_TIMEOUT, (const char*)&timeout);
if (NULL == mysql_real_connect(sql, host, "huago", "huago", "huago_production_tool", port, NULL, 0)) if (NULL == mysql_real_connect(sql, host, "huago", "huago", "huago_production_tool", port, NULL, 0))
{ {
// 连接错误 // 连接错误
@ -723,7 +726,7 @@ HGResult HGPdtToolDbUserMgrImpl::Export(const HGChar* xlsPath)
if (NULL == file) if (NULL == file)
{ {
mysql_free_result(sqlRes); mysql_free_result(sqlRes);
return HGBASE_ERR_FAIL; return HGBASE_ERR_ACCESSDENIED;
} }
const HGChar* MAIN_TEST_CN[] = {"设备序列号", "创建时间", "创建用户", "最后修改时间", "最后修改用户", const HGChar* MAIN_TEST_CN[] = {"设备序列号", "创建时间", "创建用户", "最后修改时间", "最后修改用户",