Add an option to treat empty CSV columns as nulls, not empty strings

This commit is contained in:
Eric Fischer
2018-07-19 14:33:33 -07:00
parent 3cb09d0e2a
commit 87a1bb7851
13 changed files with 3320 additions and 3 deletions
+4
View File
@@ -8,6 +8,7 @@
#include "text.hpp"
#include "csv.hpp"
#include "milo/dtoa_milo.h"
#include "options.hpp"
void parse_geocsv(std::vector<struct serialization_state> &sst, std::string fname, int layer, std::string layername) {
FILE *f;
@@ -97,6 +98,9 @@ void parse_geocsv(std::vector<struct serialization_state> &sst, std::string fnam
serial_val sv;
if (is_number(line[i])) {
sv.type = mvt_double;
} else if (line[i].size() == 0 && prevent[P_EMPTY_CSV_COLUMNS]) {
sv.type = mvt_null;
line[i] = "null";
} else {
sv.type = mvt_string;
}