fix: stmt bind crashed when colIdx exceeds column nums
This commit is contained in:
parent
9a97f976e9
commit
883eb48bf2
|
@ -1258,8 +1258,12 @@ int stmtBindBatch(TAOS_STMT* stmt, TAOS_MULTI_BIND* bind, int32_t colIdx) {
|
||||||
pStmt->bInfo.sBindRowNum = bind->num;
|
pStmt->bInfo.sBindRowNum = bind->num;
|
||||||
}
|
}
|
||||||
|
|
||||||
qBindStmtSingleColValue(*pDataBlock, pCols, bind, pStmt->exec.pRequest->msgBuf, pStmt->exec.pRequest->msgBufLen, colIdx,
|
code = qBindStmtSingleColValue(*pDataBlock, pCols, bind, pStmt->exec.pRequest->msgBuf,
|
||||||
pStmt->bInfo.sBindRowNum);
|
pStmt->exec.pRequest->msgBufLen, colIdx, pStmt->bInfo.sBindRowNum);
|
||||||
|
if (code) {
|
||||||
|
tscError("qBindStmtSingleColValue failed, error:%s", tstrerror(code));
|
||||||
|
STMT_ERR_RET(code);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int64_t startUs4 = taosGetTimestampUs();
|
int64_t startUs4 = taosGetTimestampUs();
|
||||||
|
|
|
@ -410,6 +410,11 @@ int32_t qBindStmtSingleColValue(void* pBlock, SArray* pCols, TAOS_MULTI_BIND* bi
|
||||||
return buildInvalidOperationMsg(&pBuf, "row number in each bind param should be the same");
|
return buildInvalidOperationMsg(&pBuf, "row number in each bind param should be the same");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Column index exceeds the number of columns
|
||||||
|
if (colIdx >= pCols->size && pCol == NULL) {
|
||||||
|
return buildInvalidOperationMsg(&pBuf, "column index exceeds the number of columns");
|
||||||
|
}
|
||||||
|
|
||||||
if (bind->buffer_type != pColSchema->type) {
|
if (bind->buffer_type != pColSchema->type) {
|
||||||
return buildInvalidOperationMsg(&pBuf, "column type mis-match with buffer type");
|
return buildInvalidOperationMsg(&pBuf, "column type mis-match with buffer type");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue