ret value for parTranslater.c
This commit is contained in:
parent
2b99db8b33
commit
0cccaa8ac4
|
@ -163,8 +163,8 @@ int rawBlockBindData(SQuery *query, STableMeta* pTableMeta, void* data, SVCr
|
|||
int numFields, bool needChangeLength, char* errstr, int32_t errstrLen);
|
||||
|
||||
int32_t rewriteToVnodeModifyOpStmt(SQuery* pQuery, SArray* pBufArray);
|
||||
SArray* serializeVgroupsCreateTableBatch(SHashObj* pVgroupHashmap);
|
||||
SArray* serializeVgroupsDropTableBatch(SHashObj* pVgroupHashmap);
|
||||
int32_t serializeVgroupsCreateTableBatch(SHashObj* pVgroupHashmap, SArray** pOut);
|
||||
int32_t serializeVgroupsDropTableBatch(SHashObj* pVgroupHashmap, SArray** pOut);
|
||||
void destoryCatalogReq(SCatalogReq *pCatalogReq);
|
||||
bool isPrimaryKeyImpl(SNode* pExpr);
|
||||
int32_t insAppendStmtTableDataCxt(SHashObj* pAllVgHash, STableColsData* pTbData, STableDataCxt* pTbCtx, SStbInterlaceInfo* pBuildInfo);
|
||||
|
|
|
@ -1116,9 +1116,9 @@ static int32_t taosCreateTable(TAOS* taos, void* meta, int32_t metaLen) {
|
|||
if (taosHashGetSize(pVgroupHashmap) == 0) {
|
||||
goto end;
|
||||
}
|
||||
SArray* pBufArray = serializeVgroupsCreateTableBatch(pVgroupHashmap);
|
||||
if (NULL == pBufArray) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
SArray* pBufArray = NULL;
|
||||
code = serializeVgroupsCreateTableBatch(pVgroupHashmap, &pBufArray);
|
||||
if (TSDB_CODE_SUCCESS != code) {
|
||||
goto end;
|
||||
}
|
||||
|
||||
|
@ -1264,9 +1264,9 @@ static int32_t taosDropTable(TAOS* taos, void* meta, int32_t metaLen) {
|
|||
if (taosHashGetSize(pVgroupHashmap) == 0) {
|
||||
goto end;
|
||||
}
|
||||
SArray* pBufArray = serializeVgroupsDropTableBatch(pVgroupHashmap);
|
||||
if (NULL == pBufArray) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
SArray* pBufArray = NULL;
|
||||
code = serializeVgroupsDropTableBatch(pVgroupHashmap, &pBufArray);
|
||||
if (TSDB_CODE_SUCCESS != code) {
|
||||
goto end;
|
||||
}
|
||||
|
||||
|
|
|
@ -98,7 +98,7 @@ SName* toName(int32_t acctId, const char* pDbName, const char* pTableName, SName
|
|||
int32_t tNameExtractFullName(const SName* name, char* dst) {
|
||||
// invalid full name format, abort
|
||||
if (!tNameIsValid(name)) {
|
||||
return -1;
|
||||
return TSDB_CODE_INVALID_PARA;
|
||||
}
|
||||
|
||||
int32_t len = snprintf(dst, TSDB_DB_FNAME_LEN, "%d.%s", name->acctId, name->dbname);
|
||||
|
@ -154,8 +154,7 @@ int32_t tNameGetDbName(const SName* name, char* dst) {
|
|||
const char* tNameGetDbNameP(const SName* name) { return &name->dbname[0]; }
|
||||
|
||||
int32_t tNameGetFullDbName(const SName* name, char* dst) {
|
||||
snprintf(dst, TSDB_DB_FNAME_LEN, "%d.%s", name->acctId, name->dbname);
|
||||
return 0;
|
||||
return snprintf(dst, TSDB_DB_FNAME_LEN, "%d.%s", name->acctId, name->dbname);
|
||||
}
|
||||
|
||||
bool tNameIsEmpty(const SName* name) { return name->type == 0 || name->acctId == 0; }
|
||||
|
|
|
@ -47,7 +47,7 @@ typedef struct STranslateContext {
|
|||
SNode* pPostRoot;
|
||||
} STranslateContext;
|
||||
|
||||
bool biRewriteToTbnameFunc(STranslateContext* pCxt, SNode** ppNode);
|
||||
int32_t biRewriteToTbnameFunc(STranslateContext* pCxt, SNode** ppNode, bool* pRet);
|
||||
int32_t biRewriteSelectStar(STranslateContext* pCxt, SSelectStmt* pSelect);
|
||||
int32_t biCheckCreateTableTbnameCol(STranslateContext* pCxt, SCreateTableStmt* pStmt);
|
||||
int32_t findTable(STranslateContext* pCxt, const char* pTableAlias, STableNode** pOutput);
|
||||
|
|
|
@ -509,7 +509,7 @@ cmd ::= SHOW USERS FULL.
|
|||
cmd ::= SHOW USER PRIVILEGES. { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_USER_PRIVILEGES_STMT); }
|
||||
cmd ::= SHOW db_kind_opt(A) DATABASES. {
|
||||
pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_DATABASES_STMT);
|
||||
setShowKind(pCxt, pCxt->pRootNode, A);
|
||||
(void)setShowKind(pCxt, pCxt->pRootNode, A);
|
||||
}
|
||||
cmd ::= SHOW table_kind_db_name_cond_opt(A) TABLES like_pattern_opt(B). {
|
||||
pCxt->pRootNode = createShowTablesStmt(pCxt, A, B, OP_TYPE_LIKE);
|
||||
|
|
|
@ -101,7 +101,7 @@ static bool checkPassword(SAstCreateContext* pCxt, const SToken* pPasswordToken,
|
|||
pCxt->errCode = generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_NAME_OR_PASSWD_TOO_LONG);
|
||||
} else {
|
||||
strncpy(pPassword, pPasswordToken->z, pPasswordToken->n);
|
||||
strdequote(pPassword);
|
||||
(void)strdequote(pPassword);
|
||||
if (strtrim(pPassword) <= 0) {
|
||||
pCxt->errCode = generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_PASSWD_EMPTY);
|
||||
} else if (invalidPassword(pPassword)) {
|
||||
|
@ -126,8 +126,8 @@ static int32_t parseEndpoint(SAstCreateContext* pCxt, const SToken* pEp, char* p
|
|||
|
||||
char ep[TSDB_FQDN_LEN + 1 + 5] = {0};
|
||||
COPY_STRING_FORM_ID_TOKEN(ep, pEp);
|
||||
strdequote(ep);
|
||||
strtrim(ep);
|
||||
(void)strdequote(ep);
|
||||
(void)strtrim(ep);
|
||||
if (NULL == pPort) {
|
||||
strcpy(pFqdn, ep);
|
||||
return TSDB_CODE_SUCCESS;
|
||||
|
@ -371,7 +371,7 @@ SNode* createValueNode(SAstCreateContext* pCxt, int32_t dataType, const SToken*
|
|||
val->literal = strndup(pLiteral->z, pLiteral->n);
|
||||
if (TK_NK_ID != pLiteral->type && TK_TIMEZONE != pLiteral->type &&
|
||||
(IS_VAR_DATA_TYPE(dataType) || TSDB_DATA_TYPE_TIMESTAMP == dataType)) {
|
||||
trimString(pLiteral->z, pLiteral->n, val->literal, pLiteral->n);
|
||||
(void)trimString(pLiteral->z, pLiteral->n, val->literal, pLiteral->n);
|
||||
}
|
||||
CHECK_OUT_OF_MEM(val->literal);
|
||||
val->node.resType.type = dataType;
|
||||
|
@ -784,7 +784,10 @@ SNode* createPlaceholderValueNode(SAstCreateContext* pCxt, const SToken* pLitera
|
|||
return NULL;
|
||||
}
|
||||
}
|
||||
taosArrayPush(pCxt->pPlaceholderValues, &val);
|
||||
if (NULL == taosArrayPush(pCxt->pPlaceholderValues, &val)) {
|
||||
pCxt->errCode = TSDB_CODE_OUT_OF_MEMORY;
|
||||
}
|
||||
CHECK_PARSER_STATUS(pCxt);
|
||||
return (SNode*)val;
|
||||
}
|
||||
|
||||
|
@ -905,7 +908,8 @@ SNode* createCastFunctionNode(SAstCreateContext* pCxt, SNode* pExpr, SDataType d
|
|||
} else if (TSDB_DATA_TYPE_NCHAR == dt.type) {
|
||||
func->node.resType.bytes = func->node.resType.bytes * TSDB_NCHAR_SIZE + VARSTR_HEADER_SIZE;
|
||||
}
|
||||
nodesListMakeAppend(&func->pParameterList, pExpr);
|
||||
pCxt->errCode = nodesListMakeAppend(&func->pParameterList, pExpr);
|
||||
CHECK_PARSER_STATUS(pCxt);
|
||||
return (SNode*)func;
|
||||
}
|
||||
|
||||
|
@ -923,8 +927,10 @@ SNode* createNodeListNodeEx(SAstCreateContext* pCxt, SNode* p1, SNode* p2) {
|
|||
CHECK_OUT_OF_MEM(list);
|
||||
list->pNodeList = nodesMakeList();
|
||||
CHECK_OUT_OF_MEM(list->pNodeList);
|
||||
nodesListAppend(list->pNodeList, p1);
|
||||
nodesListAppend(list->pNodeList, p2);
|
||||
pCxt->errCode = nodesListAppend(list->pNodeList, p1);
|
||||
CHECK_PARSER_STATUS(pCxt);
|
||||
pCxt->errCode = nodesListAppend(list->pNodeList, p2);
|
||||
CHECK_PARSER_STATUS(pCxt);
|
||||
return (SNode*)list;
|
||||
}
|
||||
|
||||
|
@ -1121,7 +1127,8 @@ SNode* createGroupingSetNode(SAstCreateContext* pCxt, SNode* pNode) {
|
|||
CHECK_OUT_OF_MEM(groupingSet);
|
||||
groupingSet->groupingSetType = GP_TYPE_NORMAL;
|
||||
groupingSet->pParameterList = nodesMakeList();
|
||||
nodesListAppend(groupingSet->pParameterList, pNode);
|
||||
pCxt->errCode = nodesListAppend(groupingSet->pParameterList, pNode);
|
||||
CHECK_PARSER_STATUS(pCxt);
|
||||
return (SNode*)groupingSet;
|
||||
}
|
||||
|
||||
|
@ -1842,7 +1849,7 @@ SNode* createCreateSubTableFromFileClause(SAstCreateContext* pCxt, bool ignoreEx
|
|||
pStmt->ignoreExists = ignoreExists;
|
||||
pStmt->pSpecificTags = pSpecificTags;
|
||||
if (TK_NK_STRING == pFilePath->type) {
|
||||
trimString(pFilePath->z, pFilePath->n, pStmt->filePath, PATH_MAX);
|
||||
(void)trimString(pFilePath->z, pFilePath->n, pStmt->filePath, PATH_MAX);
|
||||
} else {
|
||||
strncpy(pStmt->filePath, pFilePath->z, pFilePath->n);
|
||||
}
|
||||
|
@ -2087,7 +2094,7 @@ SNode* createShowTablesStmt(SAstCreateContext* pCxt, SShowTablesOption option, S
|
|||
pDbName = createIdentifierValueNode(pCxt, &option.dbName);
|
||||
}
|
||||
SNode* pStmt = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_TABLES_STMT, pDbName, pTbName, tableCondType);
|
||||
setShowKind(pCxt, pStmt, option.kind);
|
||||
(void)setShowKind(pCxt, pStmt, option.kind);
|
||||
return pStmt;
|
||||
}
|
||||
|
||||
|
@ -2408,9 +2415,9 @@ SNode* createAlterDnodeStmt(SAstCreateContext* pCxt, const SToken* pDnode, const
|
|||
} else {
|
||||
pStmt->dnodeId = -1;
|
||||
}
|
||||
trimString(pConfig->z, pConfig->n, pStmt->config, sizeof(pStmt->config));
|
||||
(void)trimString(pConfig->z, pConfig->n, pStmt->config, sizeof(pStmt->config));
|
||||
if (NULL != pValue) {
|
||||
trimString(pValue->z, pValue->n, pStmt->value, sizeof(pStmt->value));
|
||||
(void)trimString(pValue->z, pValue->n, pStmt->value, sizeof(pStmt->value));
|
||||
}
|
||||
return (SNode*)pStmt;
|
||||
}
|
||||
|
@ -2591,9 +2598,9 @@ SNode* createAlterClusterStmt(SAstCreateContext* pCxt, const SToken* pConfig, co
|
|||
CHECK_PARSER_STATUS(pCxt);
|
||||
SAlterClusterStmt* pStmt = (SAlterClusterStmt*)nodesMakeNode(QUERY_NODE_ALTER_CLUSTER_STMT);
|
||||
CHECK_OUT_OF_MEM(pStmt);
|
||||
trimString(pConfig->z, pConfig->n, pStmt->config, sizeof(pStmt->config));
|
||||
(void)trimString(pConfig->z, pConfig->n, pStmt->config, sizeof(pStmt->config));
|
||||
if (NULL != pValue) {
|
||||
trimString(pValue->z, pValue->n, pStmt->value, sizeof(pStmt->value));
|
||||
(void)trimString(pValue->z, pValue->n, pStmt->value, sizeof(pStmt->value));
|
||||
}
|
||||
return (SNode*)pStmt;
|
||||
}
|
||||
|
@ -2602,9 +2609,9 @@ SNode* createAlterLocalStmt(SAstCreateContext* pCxt, const SToken* pConfig, cons
|
|||
CHECK_PARSER_STATUS(pCxt);
|
||||
SAlterLocalStmt* pStmt = (SAlterLocalStmt*)nodesMakeNode(QUERY_NODE_ALTER_LOCAL_STMT);
|
||||
CHECK_OUT_OF_MEM(pStmt);
|
||||
trimString(pConfig->z, pConfig->n, pStmt->config, sizeof(pStmt->config));
|
||||
(void)trimString(pConfig->z, pConfig->n, pStmt->config, sizeof(pStmt->config));
|
||||
if (NULL != pValue) {
|
||||
trimString(pValue->z, pValue->n, pStmt->value, sizeof(pStmt->value));
|
||||
(void)trimString(pValue->z, pValue->n, pStmt->value, sizeof(pStmt->value));
|
||||
}
|
||||
return (SNode*)pStmt;
|
||||
}
|
||||
|
@ -2869,7 +2876,7 @@ SNode* createKillQueryStmt(SAstCreateContext* pCxt, const SToken* pQueryId) {
|
|||
CHECK_PARSER_STATUS(pCxt);
|
||||
SKillQueryStmt* pStmt = (SKillQueryStmt*)nodesMakeNode(QUERY_NODE_KILL_QUERY_STMT);
|
||||
CHECK_OUT_OF_MEM(pStmt);
|
||||
trimString(pQueryId->z, pQueryId->n, pStmt->queryId, sizeof(pStmt->queryId) - 1);
|
||||
(void)trimString(pQueryId->z, pQueryId->n, pStmt->queryId, sizeof(pStmt->queryId) - 1);
|
||||
return (SNode*)pStmt;
|
||||
}
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue