提交 2beb6f04 编写于 作者: H hjxilinx

[td-99] refactor codes.

上级 2b0d202f
...@@ -155,6 +155,10 @@ static void syncConnCallback(void *param, TAOS_RES *tres, int code) { ...@@ -155,6 +155,10 @@ static void syncConnCallback(void *param, TAOS_RES *tres, int code) {
STscObj *pObj = (STscObj *)param; STscObj *pObj = (STscObj *)param;
assert(pObj != NULL && pObj->pSql != NULL); assert(pObj != NULL && pObj->pSql != NULL);
if (code < 0) {
pObj->pSql->res.code = code;
}
sem_post(&pObj->pSql->rspSem); sem_post(&pObj->pSql->rspSem);
} }
...@@ -177,6 +181,7 @@ TAOS *taos_connect(const char *ip, const char *user, const char *pass, const cha ...@@ -177,6 +181,7 @@ TAOS *taos_connect(const char *ip, const char *user, const char *pass, const cha
sem_wait(&pSql->rspSem); sem_wait(&pSql->rspSem);
if (pSql->res.code != TSDB_CODE_SUCCESS) { if (pSql->res.code != TSDB_CODE_SUCCESS) {
terrno = pSql->res.code;
taos_close(pObj); taos_close(pObj);
return NULL; return NULL;
} }
...@@ -186,8 +191,7 @@ TAOS *taos_connect(const char *ip, const char *user, const char *pass, const cha ...@@ -186,8 +191,7 @@ TAOS *taos_connect(const char *ip, const char *user, const char *pass, const cha
// version compare only requires the first 3 segments of the version string // version compare only requires the first 3 segments of the version string
int code = taosCheckVersion(version, taos_get_server_info(pObj), 3); int code = taosCheckVersion(version, taos_get_server_info(pObj), 3);
if (code != 0) { if (code != 0) {
pSql->res.code = code; terrno = code;
taos_close(pObj); taos_close(pObj);
return NULL; return NULL;
} else { } else {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册