mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-18 05:32:52 +00:00
34 lines
710 B
C++
34 lines
710 B
C++
#include <DB/IO/WriteBuffer.h>
|
|
#include <DB/Core/Block.h>
|
|
#include <DB/DataStreams/TabSeparatedBlockOutputStream.h>
|
|
|
|
|
|
namespace DB
|
|
{
|
|
|
|
void TabSeparatedBlockOutputStream::flush()
|
|
{
|
|
ostr.next();
|
|
}
|
|
|
|
void TabSeparatedBlockOutputStream::write(const Block & block)
|
|
{
|
|
size_t columns = block.columns();
|
|
for (size_t i = 0; i < columns; ++i)
|
|
{
|
|
const ColumnWithTypeAndName & col = block.safeGetByPosition(i);
|
|
|
|
size_t rows = block.rows();
|
|
for (size_t j = 0; j < rows; ++j)
|
|
{
|
|
if (j != 0)
|
|
ostr.write('\t');
|
|
col.type->serializeTextEscaped(*col.column.get(), j, ostr);
|
|
}
|
|
ostr.write('\n');
|
|
}
|
|
ostr.write('\n');
|
|
}
|
|
|
|
}
|