diff -r e4118c36bef6 -r a7596589a5b0 src/CSVHandler.h --- a/src/CSVHandler.h Sat Jun 06 01:50:44 2020 +0200 +++ b/src/CSVHandler.h Wed Sep 23 17:17:39 2020 +0200 @@ -29,6 +29,7 @@ #include #include +#include "Configuration.h" #include "RelpipeCSVWriterException.h" namespace relpipe { @@ -42,19 +43,20 @@ class CSVHandler : public RelationalReaderStringHandler { private: std::ostream& output; + Configuration& configuration; const char QUOTE = '"'; std::wstring_convert> convertor; // TODO: local system encoding or generate CSV always in UTF-8 like XML? std::vector firstAttributes; integer_t valueCount = 0; public: - CSVHandler(std::ostream& output) : output(output) { + CSVHandler(std::ostream& output, Configuration& configuration) : output(output), configuration(configuration) { } void startRelation(string_t name, std::vector attributes) override { if (firstAttributes.empty()) { firstAttributes = attributes; - for (auto attr : attributes) attribute(attr.getAttributeName()); + if (configuration.writeHeader) for (auto attr : attributes) attribute(attr.getAttributeName()); } else { // TODO: UNION ALL if data types and attribute count matches throw RelpipeCSVWriterException(L"Only a single relation can be converted to the CSV format.");