# HG changeset patch # User František Kučera # Date 1536528057 -7200 # Node ID a64afb2d24c9032adca6edff520280ef09138d02 # Parent 8ae93a43fed26ebcc074038fa92983950dbdc6ad use AttributeMetadata instead of std::pair for relation header diff -r 8ae93a43fed2 -r a64afb2d24c9 include/relpipe/writer/AttributeMetadata.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/include/relpipe/writer/AttributeMetadata.h Sun Sep 09 23:20:57 2018 +0200 @@ -0,0 +1,15 @@ +#pragma once + +#include "TypeId.h" + +namespace relpipe { +namespace writer { + +class AttributeMetadata { +public: + string_t attributeName; + relpipe::writer::TypeId typeId; +}; + +} +} \ No newline at end of file diff -r 8ae93a43fed2 -r a64afb2d24c9 include/relpipe/writer/RelationalWriter.h --- a/include/relpipe/writer/RelationalWriter.h Mon Sep 03 23:41:29 2018 +0200 +++ b/include/relpipe/writer/RelationalWriter.h Sun Sep 09 23:20:57 2018 +0200 @@ -5,6 +5,7 @@ #include "typedefs.h" #include "TypeId.h" +#include "AttributeMetadata.h" namespace relpipe { namespace writer { @@ -28,7 +29,7 @@ * @param attributes list of attributes (columns) containing their names and types * @param writeHeader header might be omitted – when appending new records to a stream alreaready containing the header */ - virtual void startRelation(string_t name, std::vector> attributes, boolean_t writeHeader) = 0; + virtual void startRelation(string_t name, std::vector attributes, boolean_t writeHeader) = 0; /** * Writes a single attribute. diff -r 8ae93a43fed2 -r a64afb2d24c9 nbproject/configurations.xml --- a/nbproject/configurations.xml Mon Sep 03 23:41:29 2018 +0200 +++ b/nbproject/configurations.xml Sun Sep 09 23:20:57 2018 +0200 @@ -4,6 +4,7 @@ + include/relpipe/writer/AttributeMetadata.h src/types/BooleanDataTypeWriter.h src/DataTypeWriter.h src/DataTypeWriterBase.h @@ -55,6 +56,11 @@ + + + + > attributes, boolean_t writeHeader) override { + void startRelation(string_t name, std::vector attributes, boolean_t writeHeader) override { string_t tableName = name; columnCount = attributes.size(); currentColumn = 0; @@ -77,13 +78,13 @@ // Write column names: for (size_t c = 0; c < columnCount; c++) { - wstring columnName = attributes[c].first; + wstring columnName = attributes[c].attributeName; stringWriter.writeValue(output, columnName); } // Write column types: for (size_t c = 0; c < columnCount; c++) { - TypeId typeId = attributes[c].second; + TypeId typeId = attributes[c].typeId; integerWriter.writeValue(output, static_cast (typeId)); columnTypes[c] = typeId; }