From 4d3d48d3b77de38957b5a8eee56516101617bb4b Mon Sep 17 00:00:00 2001 From: Alex Duan <417921451@qq.com> Date: Tue, 13 Jun 2023 18:06:27 +0800 Subject: [PATCH] fix:uniform output csv format with shell output --- tools/shell/src/shellEngine.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tools/shell/src/shellEngine.c b/tools/shell/src/shellEngine.c index 38d0cca773..865d4680a3 100644 --- a/tools/shell/src/shellEngine.c +++ b/tools/shell/src/shellEngine.c @@ -326,6 +326,7 @@ void shellDumpFieldToFile(TdFilePtr pFile, const char *val, TAOS_FIELD *field, i char quotationStr[2]; quotationStr[0] = '\"'; quotationStr[1] = 0; + int32_t width; int n; char buf[TSDB_MAX_BYTES_PER_ROW]; @@ -358,7 +359,7 @@ void shellDumpFieldToFile(TdFilePtr pFile, const char *val, TAOS_FIELD *field, i taosFprintfFile(pFile, "%" PRIu64, *((uint64_t *)val)); break; case TSDB_DATA_TYPE_FLOAT: - int32_t width = SHELL_FLOAT_WIDTH; + width = SHELL_FLOAT_WIDTH; if (tsEnableScience) { taosFprintfFile(pFile, "%*e", width, GET_FLOAT_VAL(val)); } else { @@ -371,7 +372,7 @@ void shellDumpFieldToFile(TdFilePtr pFile, const char *val, TAOS_FIELD *field, i } break; case TSDB_DATA_TYPE_DOUBLE: - int32_t width = SHELL_DOUBLE_WIDTH; + width = SHELL_DOUBLE_WIDTH; if (tsEnableScience) { snprintf(buf, TSDB_MAX_BYTES_PER_ROW, "%.9e", GET_DOUBLE_VAL(val)); taosFprintfFile(pFile, "%*s", width, buf); -- GitLab