提交 ebd6256e 编写于 作者: H hjxilinx

[TD-98]

上级 b9ebb7d3
......@@ -331,7 +331,7 @@ void tscProcessAsyncRes(SSchedMsg *pMsg) {
// pCmd may be released, so cache pCmd->command
int cmd = pCmd->command;
int code = pRes->code;// ? -pRes->code : pRes->numOfRows;
int code = pRes->code;
// in case of async insert, restore the user specified callback function
bool shouldFree = tscShouldFreeAsyncSqlObj(pSql);
......
......@@ -1293,7 +1293,16 @@ int tsParseInsertSql(SSqlObj *pSql) {
int tsParseSql(SSqlObj *pSql, bool initialParse) {
int32_t ret = TSDB_CODE_SUCCESS;
tscTrace("continue parse sql: %s", pSql->asyncTblPos);
if (initialParse) {
char* p = pSql->sqlstr;
pSql->sqlstr = NULL;
tscFreeSqlObjPartial(pSql);
pSql->sqlstr = p;
} else {
tscTrace("continue parse sql: %s", pSql->asyncTblPos);
}
if (tscIsInsertOrImportData(pSql->sqlstr)) {
/*
......@@ -1302,8 +1311,6 @@ int tsParseSql(SSqlObj *pSql, bool initialParse) {
* the error handle callback function can rightfully restore the user defined function (fp)
*/
if (initialParse) {
tscFreeSqlCmdData(&pSql->cmd);
// replace user defined callback function with multi-insert proxy function
pSql->fetchFp = pSql->fp;
pSql->fp = (void(*)())tscHandleMultivnodeInsert;
......@@ -1316,10 +1323,6 @@ int tsParseSql(SSqlObj *pSql, bool initialParse) {
return ret;
}
if (initialParse) {
tscFreeSqlCmdData(&pSql->cmd);
}
SSqlInfo SQLInfo = {0};
tSQLParse(&SQLInfo, pSql->sqlstr);
......
......@@ -293,7 +293,7 @@ int taos_query(TAOS *taos, const char *sqlstr) {
SSqlObj* pSql = pObj->pSql;
size_t sqlLen = strlen(sqlstr);
doAsyncQuery(pObj, pObj->pSql, waitForQueryRsp, taos, sqlstr, sqlLen);
doAsyncQuery(pObj, pSql, waitForQueryRsp, taos, sqlstr, sqlLen);
// wait for the callback function to post the semaphore
sem_wait(&pSql->rspSem);
......
......@@ -466,9 +466,14 @@ void tscFreeSqlObjPartial(SSqlObj* pSql) {
tscFreeSqlResult(pSql);
tfree(pSql->pSubs);
pSql->numOfSubs = 0;
taosHashCleanup(pSql->pTableHashList);
pSql->freed = 0;
pSql->numOfSubs = 0;
pSql->pTableHashList = NULL;
pSql->asyncTblPos = NULL;
tscFreeSqlCmdData(pCmd);
tscTrace("%p partially free sqlObj completed", pSql);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册