fix:add json test case

This commit is contained in:
wangmm0220 2022-05-23 18:09:10 +08:00
parent 82a659c307
commit 80047eab07
2 changed files with 4 additions and 4 deletions

View File

@ -330,7 +330,7 @@ int parseJsontoTagData(const char* json, SKVRowBuilder* kvRowBuilder, SMsgBuf* p
// set json NULL data // set json NULL data
uint8_t jsonNULL = TSDB_DATA_TYPE_NULL; uint8_t jsonNULL = TSDB_DATA_TYPE_NULL;
int jsonIndex = startColId + 1; int jsonIndex = startColId + 1;
if (!json || strcasecmp(json, TSDB_DATA_NULL_STR_L) == 0) { if (!json || strtrim((char*)json) == 0 ||strcasecmp(json, TSDB_DATA_NULL_STR_L) == 0) {
tdAddColToKVRow(kvRowBuilder, jsonIndex, &jsonNULL, CHAR_BYTES); tdAddColToKVRow(kvRowBuilder, jsonIndex, &jsonNULL, CHAR_BYTES);
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }

View File

@ -52,7 +52,7 @@ size_t strtrim(char *z) {
int32_t j = 0; int32_t j = 0;
int32_t delta = 0; int32_t delta = 0;
while (z[j] == ' ') { while (isspace(z[j])) {
++j; ++j;
} }
@ -65,9 +65,9 @@ size_t strtrim(char *z) {
int32_t stop = 0; int32_t stop = 0;
while (z[j] != 0) { while (z[j] != 0) {
if (z[j] == ' ' && stop == 0) { if (isspace(z[j]) && stop == 0) {
stop = j; stop = j;
} else if (z[j] != ' ' && stop != 0) { } else if (!isspace(z[j]) && stop != 0) {
stop = 0; stop = 0;
} }