feature: shell csv rfc 4180

This commit is contained in:
afwerar 2022-08-30 16:30:20 +08:00
parent aec3a06431
commit 8a34a321c7
2 changed files with 10 additions and 8 deletions

View File

@ -1,4 +1,4 @@
char version[12] = "${TD_VER_NUMBER}"; char version[64] = "${TD_VER_NUMBER}";
char compatible_version[12] = "${TD_VER_COMPATIBLE}"; char compatible_version[12] = "${TD_VER_COMPATIBLE}";
char gitinfo[48] = "${TD_VER_GIT}"; char gitinfo[48] = "${TD_VER_GIT}";
char buildinfo[64] = "Built at ${TD_VER_DATE}"; char buildinfo[64] = "Built at ${TD_VER_DATE}";

View File

@ -320,17 +320,19 @@ void shellDumpFieldToFile(TdFilePtr pFile, const char *val, TAOS_FIELD *field, i
case TSDB_DATA_TYPE_BINARY: case TSDB_DATA_TYPE_BINARY:
case TSDB_DATA_TYPE_NCHAR: case TSDB_DATA_TYPE_NCHAR:
case TSDB_DATA_TYPE_JSON: case TSDB_DATA_TYPE_JSON:
int32_t bufIndex = 0; {
for (int32_t i = 0; i < length; i++) { int32_t bufIndex = 0;
buf[bufIndex] = val[i]; for (int32_t i = 0; i < length; i++) {
bufIndex++;
if (val[i] == '\"') {
buf[bufIndex] = val[i]; buf[bufIndex] = val[i];
bufIndex++; bufIndex++;
if (val[i] == '\"') {
buf[bufIndex] = val[i];
bufIndex++;
}
} }
buf[bufIndex] = 0;
taosFprintfFile(pFile, "%s%s%s", quotationStr, buf, quotationStr);
} }
buf[bufIndex] = 0;
taosFprintfFile(pFile, "%s%s%s", quotationStr, buf, quotationStr);
break; break;
case TSDB_DATA_TYPE_TIMESTAMP: case TSDB_DATA_TYPE_TIMESTAMP:
shellFormatTimestamp(buf, *(int64_t *)val, precision); shellFormatTimestamp(buf, *(int64_t *)val, precision);