Description
Currently the logic used to read in the statements from the input file is as follows:
while (std::getline(ifs, curline).good() && !ifs.eof()) { |
if (!curline.empty()) { |
m_queries.push_back(curline);
|
}
|
}
|
The problem with this logic is that it REQUIRES a newline at the end of the file to read in all statements. While technically this is true of every program (https://stackoverflow.com/questions/729692/why-should-text-files-end-with-a-newline), in practice people expect programs to be able to handle files with a newline at the end and without.
Instead we probably need to move the check for !ifs.eof() to within the while loop.
We may also require some additional processing to remove the trailing char received from getline().
Attachments
For Gerrit Dashboard: CCBC-907 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
91027,2 | CCBC-907: cbc-n1qlback: do not require trailing empty line for input | master | libcouchbase | Status: MERGED | +2 | +1 |
Activity
Field | Original Value | New Value |
---|---|---|
Description |
Currently the logic used to read in the statements from the input file is as follows:
{code|c} while (std::getline(ifs, curline).good() && !ifs.eof()) { if (!curline.empty()) { m_queries.push_back(curline); } } {code} The problem with this logic is that it REQUIRES a newline at the end of the file to read in all statements. While technically this is true of every program (https://stackoverflow.com/questions/729692/why-should-text-files-end-with-a-newline), in practice people expect programs to be able to handle files with a newline at the end and without. Instead we probably need to move the check for {{!ifs.eof()}} to within the while loop. We may also require some additional processing to remove the trailing char received from {{getline()}}. |
Currently the logic used to read in the statements from the input file is as follows:
{code} while (std::getline(ifs, curline).good() && !ifs.eof()) { if (!curline.empty()) { m_queries.push_back(curline); } } {code} The problem with this logic is that it REQUIRES a newline at the end of the file to read in all statements. While technically this is true of every program (https://stackoverflow.com/questions/729692/why-should-text-files-end-with-a-newline), in practice people expect programs to be able to handle files with a newline at the end and without. Instead we probably need to move the check for {{!ifs.eof()}} to within the while loop. We may also require some additional processing to remove the trailing char received from {{getline()}}. |
Description |
Currently the logic used to read in the statements from the input file is as follows:
{code} while (std::getline(ifs, curline).good() && !ifs.eof()) { if (!curline.empty()) { m_queries.push_back(curline); } } {code} The problem with this logic is that it REQUIRES a newline at the end of the file to read in all statements. While technically this is true of every program (https://stackoverflow.com/questions/729692/why-should-text-files-end-with-a-newline), in practice people expect programs to be able to handle files with a newline at the end and without. Instead we probably need to move the check for {{!ifs.eof()}} to within the while loop. We may also require some additional processing to remove the trailing char received from {{getline()}}. |
Currently the logic used to read in the statements from the input file is as follows:
{code:c} while (std::getline(ifs, curline).good() && !ifs.eof()) { if (!curline.empty()) { m_queries.push_back(curline); } } {code} The problem with this logic is that it REQUIRES a newline at the end of the file to read in all statements. While technically this is true of every program (https://stackoverflow.com/questions/729692/why-should-text-files-end-with-a-newline), in practice people expect programs to be able to handle files with a newline at the end and without. Instead we probably need to move the check for {{!ifs.eof()}} to within the while loop. We may also require some additional processing to remove the trailing char received from {{getline()}}. |
Status | New [ 10003 ] | Open [ 1 ] |
Fix Version/s | 2.8.6 [ 15057 ] |
Resolution | Fixed [ 1 ] | |
Status | Open [ 1 ] | Resolved [ 5 ] |
Story Points | 1 |
Build libcouchbase-2.8.5-118 contains libcouchbase commit e90103e6dbe07aacbb85acc24910a988f359d7fd with commit message:
CCBC-907: cbc-n1qlback: do not require trailing empty line for inputhttps://github.com/couchbase/libcouchbase/commit/e90103e6dbe07aacbb85acc24910a988f359d7fd