132 void CSVCommand::process(std::istream& input, std::shared_ptr<writer::RelationalWriter> writer, Configuration& configuration) { |
132 void CSVCommand::process(std::istream& input, std::shared_ptr<writer::RelationalWriter> writer, Configuration& configuration) { |
133 wstring_convert < codecvt_utf8<wchar_t>> convertor; // UTF-8 is required for CSV |
133 wstring_convert < codecvt_utf8<wchar_t>> convertor; // UTF-8 is required for CSV |
134 vector<AttributeMetadata> metadata; |
134 vector<AttributeMetadata> metadata; |
135 bool headerDone = false; |
135 bool headerDone = false; |
136 bool lastInRecord = false; |
136 bool lastInRecord = false; |
|
137 integer_t valueCount = 0; |
137 stringstream currentValue; |
138 stringstream currentValue; |
138 |
139 |
139 |
140 |
140 while (readValue(input, currentValue, lastInRecord) && input.good()) { |
141 while (readValue(input, currentValue, lastInRecord) && input.good()) { |
141 if (headerDone) { |
142 if (headerDone) { |
142 writer->writeAttribute(convertor.from_bytes(currentValue.str())); |
143 writer->writeAttribute(convertor.from_bytes(currentValue.str())); |
|
144 valueCount++; |
143 } else { |
145 } else { |
144 AttributeMetadata am; |
146 AttributeMetadata am; |
145 am.attributeName = convertor.from_bytes(currentValue.str()); |
147 am.attributeName = convertor.from_bytes(currentValue.str()); |
146 am.typeId = TypeId::STRING; |
148 am.typeId = TypeId::STRING; |
147 metadata.push_back(am); |
149 metadata.push_back(am); |