parent
8c1b9ea60f
commit
27300117d0
|
@ -1615,26 +1615,27 @@ static int32_t translateSubstr(SFunctionNode* pFunc, char* pErrBuf, int32_t len)
|
||||||
}
|
}
|
||||||
|
|
||||||
SExprNode* pPara0 = (SExprNode*)nodesListGetNode(pFunc->pParameterList, 0);
|
SExprNode* pPara0 = (SExprNode*)nodesListGetNode(pFunc->pParameterList, 0);
|
||||||
SExprNode* p1 = (SExprNode*)nodesListGetNode(pFunc->pParameterList, 1);
|
SExprNode* pPara1 = (SExprNode*)nodesListGetNode(pFunc->pParameterList, 1);
|
||||||
|
|
||||||
uint8_t para1Type = p1->resType.type;
|
uint8_t para0Type = pPara0->resType.type;
|
||||||
if (!IS_VAR_DATA_TYPE(pPara0->resType.type) || !IS_INTEGER_TYPE(para1Type)) {
|
uint8_t para1Type = pPara1->resType.type;
|
||||||
|
if (!IS_VAR_DATA_TYPE(para0Type) || !IS_INTEGER_TYPE(para1Type)) {
|
||||||
return invaildFuncParaTypeErrMsg(pErrBuf, len, pFunc->functionName);
|
return invaildFuncParaTypeErrMsg(pErrBuf, len, pFunc->functionName);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (((SValueNode*)p1)->datum.i < 1) {
|
if (((SValueNode*)pPara1)->datum.i == 0) {
|
||||||
return invaildFuncParaValueErrMsg(pErrBuf, len, pFunc->functionName);
|
return invaildFuncParaValueErrMsg(pErrBuf, len, pFunc->functionName);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (3 == numOfParams) {
|
if (3 == numOfParams) {
|
||||||
SExprNode* p2 = (SExprNode*)nodesListGetNode(pFunc->pParameterList, 2);
|
SExprNode* pPara2 = (SExprNode*)nodesListGetNode(pFunc->pParameterList, 2);
|
||||||
uint8_t para2Type = p2->resType.type;
|
uint8_t para2Type = pPara2->resType.type;
|
||||||
if (!IS_INTEGER_TYPE(para2Type)) {
|
if (!IS_INTEGER_TYPE(para2Type)) {
|
||||||
return invaildFuncParaTypeErrMsg(pErrBuf, len, pFunc->functionName);
|
return invaildFuncParaTypeErrMsg(pErrBuf, len, pFunc->functionName);
|
||||||
}
|
}
|
||||||
|
|
||||||
int64_t v = ((SValueNode*)p1)->datum.i;
|
int64_t v = ((SValueNode*)pPara2)->datum.i;
|
||||||
if (v < 0 || v > INT16_MAX) {
|
if (v < 0) {
|
||||||
return invaildFuncParaValueErrMsg(pErrBuf, len, pFunc->functionName);
|
return invaildFuncParaValueErrMsg(pErrBuf, len, pFunc->functionName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue