提交 3220a954 编写于 作者: wafwerar's avatar wafwerar

feature: shell csv rfc 4180

上级 4632c375
...@@ -138,15 +138,11 @@ static int dumpWebsocketToFile(const char* fname, WS_RES* wres, double* pexecute ...@@ -138,15 +138,11 @@ static int dumpWebsocketToFile(const char* fname, WS_RES* wres, double* pexecute
TAOS_FIELD* fields = (TAOS_FIELD*)ws_fetch_fields(wres); TAOS_FIELD* fields = (TAOS_FIELD*)ws_fetch_fields(wres);
int num_fields = ws_field_count(wres); int num_fields = ws_field_count(wres);
int precision = ws_result_precision(wres); int precision = ws_result_precision(wres);
bool quotation = false;
for (int col = 0; col < num_fields; col++) { for (int col = 0; col < num_fields; col++) {
if (col > 0) { if (col > 0) {
taosFprintfFile(pFile, ","); taosFprintfFile(pFile, ",");
} }
taosFprintfFile(pFile, "%s", fields[col].name); taosFprintfFile(pFile, "%s", fields[col].name);
if (fields[col].type == TSDB_DATA_TYPE_BINARY || fields[col].type == TSDB_DATA_TYPE_NCHAR || fields[col].type == TSDB_DATA_TYPE_JSON) {
quotation = true;
}
} }
taosFprintfFile(pFile, "\r\n"); taosFprintfFile(pFile, "\r\n");
do { do {
...@@ -159,7 +155,7 @@ static int dumpWebsocketToFile(const char* fname, WS_RES* wres, double* pexecute ...@@ -159,7 +155,7 @@ static int dumpWebsocketToFile(const char* fname, WS_RES* wres, double* pexecute
taosFprintfFile(pFile, ","); taosFprintfFile(pFile, ",");
} }
const void *value = ws_get_value_in_block(wres, i, j, &ty, &len); const void *value = ws_get_value_in_block(wres, i, j, &ty, &len);
shellDumpFieldToFile(pFile, (const char*)value, fields + j, len, precision, quotation); shellDumpFieldToFile(pFile, (const char*)value, fields + j, len, precision);
} }
taosFprintfFile(pFile, "\r\n"); taosFprintfFile(pFile, "\r\n");
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册