提交 ca53e4e3 编写于 作者: wmmhello's avatar wmmhello

TD-6129<feature> add json type check

上级 64f1edd6
......@@ -1084,11 +1084,11 @@ static int32_t tscCheckIfCreateTable(char **sqlstr, SSqlObj *pSql, char** boundC
if(spd.numOfBound == 1 && pTagSchema[spd.boundedColumns[0]].type == TSDB_DATA_TYPE_JSON){
char tmp = sToken.z[sToken.n];
sToken.z[sToken.n] = 0;
if(sToken.type != TK_STRING) {
tdDestroyKVRowBuilder(&kvRowBuilder);
tscDestroyBoundColumnInfo(&spd);
return tscSQLSyntaxErrMsg(pInsertParam->msg, "json type error, should be string", NULL);
}
// if(sToken.type != TK_STRING) {
// tdDestroyKVRowBuilder(&kvRowBuilder);
// tscDestroyBoundColumnInfo(&spd);
// return tscSQLSyntaxErrMsg(pInsertParam->msg, "json type error, should be string", NULL);
// }
code = parseJsontoTagData(sToken.z, &kvRowBuilder, pInsertParam->msg, pTagSchema[spd.boundedColumns[0]].colId);
if (code != TSDB_CODE_SUCCESS) {
tdDestroyKVRowBuilder(&kvRowBuilder);
......
......@@ -6072,6 +6072,15 @@ int32_t setAlterTableInfo(SSqlObj* pSql, struct SSqlInfo* pInfo) {
tdDestroyKVRowBuilder(&kvRowBuilder);
return invalidOperationMsg(pMsg, msg25);
}
char tagVal[TSDB_MAX_TAGS_LEN] = {0};
int ret = tVariantDump(&(pItem->pVar), tagVal, pTagsSchema->type, true);
if (ret != TSDB_CODE_SUCCESS) {
tdDestroyKVRowBuilder(&kvRowBuilder);
return invalidOperationMsg(pMsg, msg25);
}
tdAddColToKVRow(&kvRowBuilder, pTagsSchema->colId, pTagsSchema->type, tagVal, false);
code = parseJsontoTagData(pItem->pVar.pz, &kvRowBuilder, pMsg, pTagsSchema->colId);
if (code != TSDB_CODE_SUCCESS) {
tdDestroyKVRowBuilder(&kvRowBuilder);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册