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

change json output format

上级 331f2a1f
...@@ -750,7 +750,9 @@ static void setResRawPtrImpl(SSqlRes* pRes, SInternalField* pInfo, int32_t i, bo ...@@ -750,7 +750,9 @@ static void setResRawPtrImpl(SSqlRes* pRes, SInternalField* pInfo, int32_t i, bo
p += pInfo->field.bytes; p += pInfo->field.bytes;
} }
memcpy(pRes->urow[i], pRes->buffer[i], pInfo->field.bytes * pRes->numOfRows); memcpy(pRes->urow[i], pRes->buffer[i], pInfo->field.bytes * pRes->numOfRows);
}else if (convertNchar && pInfo->field.type == TSDB_DATA_TYPE_JSON && *(char*)(pRes->urow[i]) == TSDB_DATA_TYPE_NCHAR) { }else if (convertNchar && pInfo->field.type == TSDB_DATA_TYPE_JSON
&& *(char*)(pRes->urow[i]) == TSDB_DATA_TYPE_NCHAR
&& !isNull(POINTER_SHIFT(pRes->urow[i], CHAR_BYTES), TSDB_DATA_TYPE_JSON)) {
// convert unicode to native code in a temporary buffer extra one byte for terminated symbol // convert unicode to native code in a temporary buffer extra one byte for terminated symbol
char* buffer = realloc(pRes->buffer[i], pInfo->field.bytes * pRes->numOfRows); char* buffer = realloc(pRes->buffer[i], pInfo->field.bytes * pRes->numOfRows);
if (buffer == NULL) return; if (buffer == NULL) return;
......
...@@ -483,6 +483,7 @@ static void dumpFieldToFile(FILE* fp, char* val, TAOS_FIELD* field, int32_t leng ...@@ -483,6 +483,7 @@ static void dumpFieldToFile(FILE* fp, char* val, TAOS_FIELD* field, int32_t leng
val += CHAR_BYTES; val += CHAR_BYTES;
if(type == TSDB_DATA_TYPE_NCHAR) { if(type == TSDB_DATA_TYPE_NCHAR) {
length = varDataLen(val); length = varDataLen(val);
val = varDataVal(val);
} }
} }
...@@ -665,6 +666,7 @@ static void printField(char* val, TAOS_FIELD* field, int width, int32_t length, ...@@ -665,6 +666,7 @@ static void printField(char* val, TAOS_FIELD* field, int width, int32_t length,
val += CHAR_BYTES; val += CHAR_BYTES;
if(type == TSDB_DATA_TYPE_NCHAR) { if(type == TSDB_DATA_TYPE_NCHAR) {
length = varDataLen(val); length = varDataLen(val);
val = varDataVal(val);
} }
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册