[modify for not pSql in taos obj ]
This commit is contained in:
parent
2add3b3ef9
commit
36d91237db
|
@ -487,7 +487,7 @@ void tscTableMetaCallBack(void *param, TAOS_RES *res, int code) {
|
||||||
STableMetaInfo* pTableMetaInfo = tscGetTableMetaInfoFromCmd(pCmd, pCmd->clauseIndex, 0);
|
STableMetaInfo* pTableMetaInfo = tscGetTableMetaInfoFromCmd(pCmd, pCmd->clauseIndex, 0);
|
||||||
code = tscGetTableMeta(pSql, pTableMetaInfo);
|
code = tscGetTableMeta(pSql, pTableMetaInfo);
|
||||||
assert(code == TSDB_CODE_SUCCESS && pTableMetaInfo->pTableMeta != NULL);
|
assert(code == TSDB_CODE_SUCCESS && pTableMetaInfo->pTableMeta != NULL);
|
||||||
(*pSql->fp)(pSql->param, NULL, code);
|
(*pSql->fp)(pSql->param, pSql, code);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -494,7 +494,7 @@ TAOS_STMT* taos_stmt_init(TAOS* taos) {
|
||||||
tsem_init(&pSql->rspSem, 0, 0);
|
tsem_init(&pSql->rspSem, 0, 0);
|
||||||
pSql->signature = pSql;
|
pSql->signature = pSql;
|
||||||
pSql->pTscObj = pObj;
|
pSql->pTscObj = pObj;
|
||||||
pSql->pTscObj->pSql = pSql;
|
//pSql->pTscObj->pSql = pSql;
|
||||||
pSql->maxRetry = TSDB_MAX_REPLICA_NUM;
|
pSql->maxRetry = TSDB_MAX_REPLICA_NUM;
|
||||||
|
|
||||||
pStmt->pSql = pSql;
|
pStmt->pSql = pSql;
|
||||||
|
@ -515,7 +515,7 @@ int taos_stmt_prepare(TAOS_STMT* stmt, const char* sql, unsigned long length) {
|
||||||
//doAsyncQuery(pObj, pSql, waitForQueryRsp, taos, sqlstr, sqlLen);
|
//doAsyncQuery(pObj, pSql, waitForQueryRsp, taos, sqlstr, sqlLen);
|
||||||
SSqlCmd *pCmd = &pSql->cmd;
|
SSqlCmd *pCmd = &pSql->cmd;
|
||||||
SSqlRes *pRes = &pSql->res;
|
SSqlRes *pRes = &pSql->res;
|
||||||
pSql->param = (void*)pStmt->taos;
|
pSql->param = (void*)pSql;
|
||||||
pSql->fp = waitForQueryRsp;
|
pSql->fp = waitForQueryRsp;
|
||||||
pSql->insertType = TSDB_QUERY_TYPE_STMT_INSERT;
|
pSql->insertType = TSDB_QUERY_TYPE_STMT_INSERT;
|
||||||
|
|
||||||
|
@ -613,7 +613,12 @@ int taos_stmt_execute(TAOS_STMT* stmt) {
|
||||||
} else {
|
} else {
|
||||||
tfree(pStmt->pSql->sqlstr);
|
tfree(pStmt->pSql->sqlstr);
|
||||||
pStmt->pSql->sqlstr = sql;
|
pStmt->pSql->sqlstr = sql;
|
||||||
ret = taos_query(pStmt->taos, pStmt->pSql->sqlstr);
|
SSqlObj* pSql = taos_query((TAOS*)pStmt->taos, pStmt->pSql->sqlstr);
|
||||||
|
if (pSql != NULL) {
|
||||||
|
ret = pSql->res.code;
|
||||||
|
} else {
|
||||||
|
ret = terrno;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
|
|
|
@ -256,13 +256,7 @@ int taos_query_imp(STscObj *pObj, SSqlObj *pSql) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void waitForQueryRsp(void *param, TAOS_RES *tres, int code) {
|
void waitForQueryRsp(void *param, TAOS_RES *tres, int code) {
|
||||||
assert(param != NULL);
|
assert(tres != NULL);
|
||||||
SSqlObj *pSql = ((STscObj *)param)->pSql;
|
|
||||||
|
|
||||||
// valid error code is less than 0
|
|
||||||
if (code < 0) {
|
|
||||||
pSql->res.code = code;
|
|
||||||
}
|
|
||||||
|
|
||||||
SSqlObj *pSql = (SSqlObj *) tres;
|
SSqlObj *pSql = (SSqlObj *) tres;
|
||||||
sem_post(&pSql->rspSem);
|
sem_post(&pSql->rspSem);
|
||||||
|
|
Loading…
Reference in New Issue