insert rows as you go through csv

This commit is contained in:
2021-08-11 23:40:18 +02:00
parent 710531c455
commit cd92e27270
2 changed files with 63 additions and 72 deletions

View File

@@ -5,6 +5,10 @@
#include <string>
#include <vector>
#include <regex>
#include <functional>
#include "parser.h"
#include "table.h"
namespace usql {
@@ -20,12 +24,11 @@ namespace usql {
bool header_skiped;
public:
CsvReader(bool skip_hdr = false, char field_sep = ',', char quote_ch = '"', char line_sep = '\r',
char line_sep2 = '\n');
CsvReader(bool skip_hdr = true, char field_sep = ',', char quote_ch = '"', char line_sep = '\r', char line_sep2 = '\n');
std::vector<std::vector<std::string>> parseCSV(const std::string &csvSource);
int parseCSV2(const std::string &csvSource, std::vector<ColDefNode> &cols_def,
void (Table::*function)(const std::vector<ColDefNode>&, const std::vector<std::string>&), Table& a);
private:
void add_line(const std::vector<std::string> &line, std::vector<std::vector<std::string>> &lines);
};
}
} // namespace