# HG changeset patch # User František Kučera # Date 1650740964 -7200 # Node ID 25c1ff79297c75f02ac5c9b31e0f36523e503366 # Parent 08c392fc66e4f862e14508fce3dfde19d653685c flush the output after each attribute; TODO: configurable BufferingMode diff -r 08c392fc66e4 -r 25c1ff79297c src/StreamRelationalWriter.h --- a/src/StreamRelationalWriter.h Fri Apr 22 23:47:08 2022 +0200 +++ b/src/StreamRelationalWriter.h Sat Apr 23 21:09:24 2022 +0200 @@ -62,11 +62,13 @@ std::vector columnTypes; void writeString(const string_t &stringValue, const TypeId typeId) { + // TODO: cache writers at given positions for (DataTypeWriterBase* writer : writers) if (writer->supports(typeId)) return writer->writeString(output, stringValue); throw RelpipeWriterException(L"Unsupported data type: " + static_cast (typeId)); } void writeRaw(const void* value, const type_info& typeInfo, const TypeId typeId) { + // TODO: cache writers at given positions for (DataTypeWriterBase* writer : writers) if (writer->supports(typeId)) return writer->writeRaw(output, value, typeInfo); throw RelpipeWriterException(L"Unsupported data type: " + static_cast (typeId)); } @@ -112,6 +114,8 @@ columnTypes[c] = typeId; } + // TODO: configurable buffer control + output.flush(); } void writeAttribute(const string_t& value) override { @@ -119,6 +123,8 @@ // TODO: select writer for each attribute just once in startRelation() instead of looking it each time here writeString(value, columnTypes[currentColumn]); if (++currentColumn == columnCount) currentColumn = 0; + // TODO: configurable buffer control + output.flush(); } void writeAttribute(const void* value, const std::type_info& type) override { @@ -126,6 +132,8 @@ // TODO: select writer for each attribute just once in startRelation() instead of looking it each time here writeRaw(value, type, columnTypes[currentColumn]); if (++currentColumn == columnCount) currentColumn = 0; + // TODO: configurable buffer control + output.flush(); } };