提交 49bcb15f 编写于 作者: D dapan1121

enh: ignore head line in cvs file

上级 febb306a
......@@ -1411,6 +1411,7 @@ static int32_t parseCsvFile(SInsertParseContext* pCxt, SVnodeModifOpStmt* pStmt,
(*pNumOfRows) = 0;
char* pLine = NULL;
int64_t readLen = 0;
bool firstLine = (pStmt->fileProcessing == false);
pStmt->fileProcessing = false;
while (TSDB_CODE_SUCCESS == code && (readLen = taosGetLineFile(pStmt->fp, &pLine)) != -1) {
if (('\r' == pLine[readLen - 1]) || ('\n' == pLine[readLen - 1])) {
......@@ -1418,6 +1419,7 @@ static int32_t parseCsvFile(SInsertParseContext* pCxt, SVnodeModifOpStmt* pStmt,
}
if (readLen == 0) {
firstLine = false;
continue;
}
......@@ -1431,6 +1433,11 @@ static int32_t parseCsvFile(SInsertParseContext* pCxt, SVnodeModifOpStmt* pStmt,
strtolower(pLine, pLine);
const char* pRow = pLine;
code = parseOneRow(pCxt, (const char**)&pRow, pDataBuf, &gotRow, &token);
if (code && firstLine) {
firstLine = false;
code = 0;
continue;
}
}
if (TSDB_CODE_SUCCESS == code && gotRow) {
......@@ -1442,6 +1449,8 @@ static int32_t parseCsvFile(SInsertParseContext* pCxt, SVnodeModifOpStmt* pStmt,
pStmt->fileProcessing = true;
break;
}
firstLine = false;
}
taosMemoryFree(pLine);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册