fix col clone and release problem
This commit is contained in:
parent
e362a045c0
commit
3b741a26fa
|
@ -131,6 +131,7 @@ int32_t tValueCompare(const SValue *tv1, const SValue *tv2);
|
||||||
int32_t tRowBuild(SArray *aColVal, const STSchema *pTSchema, SRow **ppRow);
|
int32_t tRowBuild(SArray *aColVal, const STSchema *pTSchema, SRow **ppRow);
|
||||||
int32_t tRowGet(SRow *pRow, STSchema *pTSchema, int32_t iCol, SColVal *pColVal);
|
int32_t tRowGet(SRow *pRow, STSchema *pTSchema, int32_t iCol, SColVal *pColVal);
|
||||||
void tRowDestroy(SRow *pRow);
|
void tRowDestroy(SRow *pRow);
|
||||||
|
void tRowDataClear(SRow *pColData);
|
||||||
int32_t tRowSort(SArray *aRowP);
|
int32_t tRowSort(SArray *aRowP);
|
||||||
int32_t tRowMerge(SArray *aRowP, STSchema *pTSchema, int8_t flag);
|
int32_t tRowMerge(SArray *aRowP, STSchema *pTSchema, int8_t flag);
|
||||||
int32_t tRowUpsertColData(SRow *pRow, STSchema *pTSchema, SColData *aColData, int32_t nColData, int32_t flag);
|
int32_t tRowUpsertColData(SRow *pRow, STSchema *pTSchema, SColData *aColData, int32_t nColData, int32_t flag);
|
||||||
|
|
|
@ -1411,10 +1411,13 @@ int stmtBindBatch2(TAOS_STMT2* stmt, TAOS_STMT2_BIND* bind, int32_t colIdx) {
|
||||||
if (pStmt->sql.stbInterlaceMode) {
|
if (pStmt->sql.stbInterlaceMode) {
|
||||||
(*pDataBlock)->pData->flags = 0;
|
(*pDataBlock)->pData->flags = 0;
|
||||||
code = qBindStmtStbColsValue2(*pDataBlock, pCols, bind, pStmt->exec.pRequest->msgBuf,
|
code = qBindStmtStbColsValue2(*pDataBlock, pCols, bind, pStmt->exec.pRequest->msgBuf,
|
||||||
pStmt->exec.pRequest->msgBufLen, &pStmt->sql.siInfo.pTSchema, pStmt->sql.pBindInfo, pStmt->taos->optionInfo.charsetCxt);
|
pStmt->exec.pRequest->msgBufLen, &pStmt->sql.siInfo.pTSchema, pStmt->sql.pBindInfo,
|
||||||
|
pStmt->taos->optionInfo.charsetCxt);
|
||||||
} else {
|
} else {
|
||||||
|
taosArrayDestroy(pCols);
|
||||||
|
(*pDataBlock)->pData->aCol = taosArrayInit(bind->num, POINTER_BYTES);
|
||||||
code =
|
code =
|
||||||
qBindStmtColsValue2(*pDataBlock, pCols, bind, pStmt->exec.pRequest->msgBuf, pStmt->exec.pRequest->msgBufLen,
|
qBindStmtColsValue2(*pDataBlock, (*pDataBlock)->pData->aRowP, bind, pStmt->exec.pRequest->msgBuf, pStmt->exec.pRequest->msgBufLen,
|
||||||
&pStmt->sql.siInfo.pTSchema, pStmt->sql.pBindInfo, pStmt->taos->optionInfo.charsetCxt);
|
&pStmt->sql.siInfo.pTSchema, pStmt->sql.pBindInfo, pStmt->taos->optionInfo.charsetCxt);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -669,6 +669,15 @@ void tRowDestroy(SRow *pRow) {
|
||||||
if (pRow) taosMemoryFree(pRow);
|
if (pRow) taosMemoryFree(pRow);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void tRowDataClear(SRow *pColData) {
|
||||||
|
pColData->ts = 0;
|
||||||
|
pColData->len = 0;
|
||||||
|
pColData->sver = 0;
|
||||||
|
pColData->flag = 0;
|
||||||
|
pColData->numOfPKs = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static int32_t tRowPCmprFn(const void *p1, const void *p2) {
|
static int32_t tRowPCmprFn(const void *p1, const void *p2) {
|
||||||
SRowKey key1, key2;
|
SRowKey key1, key2;
|
||||||
tRowGetKey(*(SRow **)p1, &key1);
|
tRowGetKey(*(SRow **)p1, &key1);
|
||||||
|
|
|
@ -54,8 +54,13 @@ int32_t qCloneCurrentTbData(STableDataCxt* pDataBlock, SSubmitTbData** pData) {
|
||||||
|
|
||||||
int32_t colNum = taosArrayGetSize(pNew->aCol);
|
int32_t colNum = taosArrayGetSize(pNew->aCol);
|
||||||
for (int32_t i = 0; i < colNum; ++i) {
|
for (int32_t i = 0; i < colNum; ++i) {
|
||||||
SColData* pCol = (SColData*)taosArrayGet(pNew->aCol, i);
|
if (pDataBlock->pData->flags & SUBMIT_REQ_COLUMN_DATA_FORMAT) {
|
||||||
tColDataDeepClear(pCol);
|
SColData* pCol = (SColData*)taosArrayGet(pNew->aCol, i);
|
||||||
|
tColDataDeepClear(pCol);
|
||||||
|
} else {
|
||||||
|
SRow* pRowp = (SRow*)taosArrayGet(pNew->aCol, i);
|
||||||
|
tRowDataClear(pRowp);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return TSDB_CODE_SUCCESS;
|
return TSDB_CODE_SUCCESS;
|
||||||
|
@ -841,12 +846,6 @@ int32_t qBindStmtColsValue2(void* pBlock, SArray* pCols, TAOS_STMT2_BIND* bind,
|
||||||
lastColId = pColSchema->colId;
|
lastColId = pColSchema->colId;
|
||||||
}
|
}
|
||||||
|
|
||||||
SColData* pCol = taosArrayGet(pCols, c);
|
|
||||||
if (pCol == NULL || pColSchema == NULL) {
|
|
||||||
code = buildInvalidOperationMsg(&pBuf, "get column schema or column data failed");
|
|
||||||
goto _return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (bind[c].num != rowNum) {
|
if (bind[c].num != rowNum) {
|
||||||
code = buildInvalidOperationMsg(&pBuf, "row number in each bind param should be the same");
|
code = buildInvalidOperationMsg(&pBuf, "row number in each bind param should be the same");
|
||||||
goto _return;
|
goto _return;
|
||||||
|
@ -863,7 +862,7 @@ int32_t qBindStmtColsValue2(void* pBlock, SArray* pCols, TAOS_STMT2_BIND* bind,
|
||||||
if (code) {
|
if (code) {
|
||||||
goto _return;
|
goto _return;
|
||||||
}
|
}
|
||||||
pBind = &ncharBind;
|
pBindInfos[c].bind = &ncharBind;
|
||||||
} else {
|
} else {
|
||||||
pBindInfos[c].bind = bind + c;
|
pBindInfos[c].bind = bind + c;
|
||||||
}
|
}
|
||||||
|
@ -872,14 +871,14 @@ int32_t qBindStmtColsValue2(void* pBlock, SArray* pCols, TAOS_STMT2_BIND* bind,
|
||||||
pBindInfos[c].type = pColSchema->type;
|
pBindInfos[c].type = pColSchema->type;
|
||||||
pBindInfos[c].bytes = pColSchema->bytes;
|
pBindInfos[c].bytes = pColSchema->bytes;
|
||||||
|
|
||||||
// code = tColDataAddValueByBind2(pCol, pBind,
|
if (code) {
|
||||||
// IS_VAR_DATA_TYPE(pColSchema->type) ? pColSchema->bytes - VARSTR_HEADER_SIZE : -1,
|
goto _return;
|
||||||
// initCtxAsText, checkWKB);
|
}
|
||||||
if (code) {
|
|
||||||
goto _return;
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
code = tRowBuildFromBind2(pBindInfos, boundInfo->numOfBound, colInOrder, *pTSchema, pCols, &pDataBlock->ordered, &pDataBlock->duplicateTs);
|
pDataBlock->pData->flags &= ~SUBMIT_REQ_COLUMN_DATA_FORMAT;
|
||||||
|
code = tRowBuildFromBind2(pBindInfos, boundInfo->numOfBound, colInOrder, *pTSchema, pCols, &pDataBlock->ordered,
|
||||||
|
&pDataBlock->duplicateTs);
|
||||||
qDebug("stmt all %d columns bind %d rows data", boundInfo->numOfBound, rowNum);
|
qDebug("stmt all %d columns bind %d rows data", boundInfo->numOfBound, rowNum);
|
||||||
|
|
||||||
_return:
|
_return:
|
||||||
|
@ -1127,15 +1126,24 @@ int32_t qResetStmtDataBlock(STableDataCxt* block, bool deepClear) {
|
||||||
int32_t colNum = taosArrayGetSize(pBlock->pData->aCol);
|
int32_t colNum = taosArrayGetSize(pBlock->pData->aCol);
|
||||||
|
|
||||||
for (int32_t i = 0; i < colNum; ++i) {
|
for (int32_t i = 0; i < colNum; ++i) {
|
||||||
SColData* pCol = (SColData*)taosArrayGet(pBlock->pData->aCol, i);
|
if (pBlock->pData->flags & SUBMIT_REQ_COLUMN_DATA_FORMAT) {
|
||||||
if (pCol == NULL) {
|
SColData* pCol = (SColData*)taosArrayGet(pBlock->pData->aCol, i);
|
||||||
qError("qResetStmtDataBlock column is NULL");
|
if (pCol == NULL) {
|
||||||
return terrno;
|
qError("qResetStmtDataBlock column is NULL");
|
||||||
}
|
return terrno;
|
||||||
if (deepClear) {
|
}
|
||||||
tColDataDeepClear(pCol);
|
if (deepClear) {
|
||||||
|
tColDataDeepClear(pCol);
|
||||||
|
} else {
|
||||||
|
tColDataClear(pCol);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
tColDataClear(pCol);
|
SRow* aRowP = (SRow*)taosArrayGet(pBlock->pData->aRowP, i);
|
||||||
|
if (aRowP == NULL) {
|
||||||
|
qError("qResetStmtDataBlock row pointer is NULL");
|
||||||
|
return terrno;
|
||||||
|
}
|
||||||
|
tRowDataClear(aRowP);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue