提交 87e8dd9e 编写于 作者: X xywang

[TS-1289]<fix>: fixed error in show create stable if tag type was json

上级 e80aeb30
...@@ -4533,13 +4533,21 @@ void getJsonTagValueAll(void* data, void* dst, int16_t bytes) { ...@@ -4533,13 +4533,21 @@ void getJsonTagValueAll(void* data, void* dst, int16_t bytes) {
return; return;
} }
char *p = NULL;
char* str = malloc(strlen(json) + 3);
if (str) {
snprintf(str, len + 3, "'%s'", json);
}
p = str ? str : json;
int32_t length = 0; int32_t length = 0;
if(!taosMbsToUcs4(json, strlen(json), varDataVal(tagData), bytes - VARSTR_HEADER_SIZE - CHAR_BYTES, &length)){ if(!taosMbsToUcs4(p, strlen(p), varDataVal(tagData), bytes - VARSTR_HEADER_SIZE - CHAR_BYTES, &length)){
tsdbError("getJsonTagValueAll mbstoucs4 error! length:%d", length); tsdbError("getJsonTagValueAll mbstoucs4 error! length:%d", length);
} }
varDataSetLen(tagData, length); varDataSetLen(tagData, length);
assert(varDataTLen(tagData) <= bytes); assert(varDataTLen(tagData) <= bytes);
tfree(json); tfree(json);
tfree(str);
} }
char* parseTagDatatoJson(void *p){ char* parseTagDatatoJson(void *p){
......
...@@ -573,12 +573,6 @@ uint32_t tGetToken(char* z, uint32_t* tokenId) { ...@@ -573,12 +573,6 @@ uint32_t tGetToken(char* z, uint32_t* tokenId) {
*tokenId = TK_ID; *tokenId = TK_ID;
return i; return i;
} }
case '{': {
for (i = 1; z[i] && z[i - 1] != '}'; i++) {
}
*tokenId = TK_STRING;
return i;
}
case 'T': case 'T':
case 't': case 't':
case 'F': case 'F':
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册