提交 6ace40b3 编写于 作者: weixin_48148422's avatar weixin_48148422

improve error message of multiple file import

上级 868a243a
...@@ -167,9 +167,11 @@ static void shellSourceFile(TAOS *con, char *fptr) { ...@@ -167,9 +167,11 @@ static void shellSourceFile(TAOS *con, char *fptr) {
return; return;
} }
fprintf(stdout, "start to dispose file:%s\n", fname); fprintf(stdout, "begin import file:%s\n", fname);
int lineNo = 0;
while ((read_len = getline(&line, &line_len, f)) != -1) { while ((read_len = getline(&line, &line_len, f)) != -1) {
++lineNo;
if (read_len >= MAX_COMMAND_SIZE) continue; if (read_len >= MAX_COMMAND_SIZE) continue;
line[--read_len] = '\0'; line[--read_len] = '\0';
...@@ -186,7 +188,10 @@ static void shellSourceFile(TAOS *con, char *fptr) { ...@@ -186,7 +188,10 @@ static void shellSourceFile(TAOS *con, char *fptr) {
memcpy(cmd + cmd_len, line, read_len); memcpy(cmd + cmd_len, line, read_len);
if (taos_query(con, cmd)) { if (taos_query(con, cmd)) {
taos_error(con); fprintf(stderr, "DB error: %s: %s (%d)\n", taos_errstr(con), fname, lineNo);
/* free local resouce: allocated memory/metric-meta refcnt */
TAOS_RES *pRes = taos_use_result(con);
taos_free_result(pRes);
} }
memset(cmd, 0, MAX_COMMAND_SIZE); memset(cmd, 0, MAX_COMMAND_SIZE);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册