some more TODOs resolved

This commit is contained in:
2021-08-14 15:07:41 +02:00
parent 0f586aab8a
commit fc0ce36e8d
9 changed files with 136 additions and 145 deletions

View File

@@ -18,27 +18,27 @@ namespace usql {
}
int CsvReader::parseCSV(const std::string &filename, std::vector<ColDefNode> &cols_def, Table& table) {
int CsvReader::parseCSV(const std::string &filename, std::vector<ColDefNode> &cols_def, Table &table) {
std::vector<ColDefNode> cdefs;
cdefs.reserve(cols_def.size());
for(auto & cd : cols_def) {
for (auto &cd : cols_def) {
cdefs.emplace_back(table.get_column_def(cd.name));
}
int row_cnt = 0;
bool inQuote(false);
std::string field;
std::string csvSource;
int row_cnt = 0;
bool inQuote(false);
std::string field;
std::string csvSource;
std::vector<std::string> line;
line.reserve(32);
std::fstream newfile;
newfile.open(filename, std::ios::in);
/// if (newfile.is_open()){ //checking whether the file is open
/// if (newfile.is_open()){ //checking whether the file is open
while(getline(newfile, csvSource)){
while (getline(newfile, csvSource)) {
if (skip_header && !header_skiped) {
header_skiped = true;
continue;
@@ -69,13 +69,13 @@ namespace usql {
field.clear();
line.clear();
// DEBUG if (row_cnt > 1000) break;
}
newfile.close();
newfile.close();
return row_cnt;
}
}
int CsvReader::parseCSV2(const std::string &csvSource, std::vector<ColDefNode> &cols_def, Table& table) {
int row_cnt = 0;