mirror of
https://github.com/sqlitebrowser/sqlitebrowser.git
synced 2026-01-20 19:11:39 -06:00
Do not roll back when importing CSV file without final line break
When importing a CSV file which uses quotes to escape characters we would throw an error if the very last character in the file is the end quote character. This commit changes it to only error when ending in the middle of a quoted field but not at the end anymore. See issue #1986.
This commit is contained in:
@@ -292,7 +292,9 @@ CSVParser::ParserResult CSVParser::parse(csvRowFunction insertFunction, QTextStr
|
||||
if(m_pCSVProgress)
|
||||
m_pCSVProgress->end();
|
||||
|
||||
return (state == StateNormal) ? ParserResult::ParserResultSuccess : ParserResult::ParserResultError;
|
||||
// Check if we are in StateNormal or StateEndQuote state. The first is what we should be in for unquoted data and all files which
|
||||
// end with a line break. The latter is what we are in for quoted data with no final line break.
|
||||
return (state == StateNormal || state == StateEndQuote) ? ParserResult::ParserResultSuccess : ParserResult::ParserResultError;
|
||||
}
|
||||
|
||||
bool CSVParser::look_ahead(QTextStream& stream, QByteArray& sBuffer, const char** it, const char** sBufferEnd, char expected)
|
||||
|
||||
Reference in New Issue
Block a user