2011-11-28 04:05:53 +00:00
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include <DB/Core/Block.h>
|
|
|
|
|
#include <DB/Core/Names.h>
|
|
|
|
|
#include <DB/IO/WriteBuffer.h>
|
|
|
|
|
#include <DB/DataStreams/IRowOutputStream.h>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
namespace DB
|
|
|
|
|
{
|
|
|
|
|
|
2012-11-10 04:43:04 +00:00
|
|
|
|
/** Поток для вывода данных в формате "каждое значение на своей строке".
|
2011-11-28 04:05:53 +00:00
|
|
|
|
*/
|
|
|
|
|
class VerticalRowOutputStream : public IRowOutputStream
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
VerticalRowOutputStream(WriteBuffer & ostr_, const Block & sample_);
|
|
|
|
|
|
2016-02-16 16:39:39 +00:00
|
|
|
|
void writeField(const IColumn & column, const IDataType & type, size_t row_num) override;
|
2014-11-08 23:52:18 +00:00
|
|
|
|
void writeRowStartDelimiter() override;
|
|
|
|
|
void writeRowBetweenDelimiter() override;
|
2011-11-28 04:05:53 +00:00
|
|
|
|
|
2014-11-08 23:52:18 +00:00
|
|
|
|
void flush() override { ostr.next(); }
|
2014-08-14 20:27:41 +00:00
|
|
|
|
|
2015-09-20 04:04:52 +00:00
|
|
|
|
protected:
|
2016-02-16 16:39:39 +00:00
|
|
|
|
virtual void writeValue(const IColumn & column, const IDataType & type, size_t row_num) const;
|
2015-09-20 04:04:52 +00:00
|
|
|
|
|
2011-11-28 04:05:53 +00:00
|
|
|
|
WriteBuffer & ostr;
|
2012-10-10 18:32:45 +00:00
|
|
|
|
const Block sample;
|
2011-11-28 04:05:53 +00:00
|
|
|
|
Names names;
|
|
|
|
|
size_t field_number;
|
|
|
|
|
size_t row_number;
|
|
|
|
|
|
2016-05-28 10:35:44 +00:00
|
|
|
|
using Pads_t = std::vector<String>;
|
2011-11-28 04:05:53 +00:00
|
|
|
|
Pads_t pads;
|
|
|
|
|
};
|
|
|
|
|
|
2015-09-20 04:04:52 +00:00
|
|
|
|
|
|
|
|
|
/** То же самое, но строки выводятся без экранирования.
|
|
|
|
|
*/
|
|
|
|
|
class VerticalRawRowOutputStream : public VerticalRowOutputStream
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
VerticalRawRowOutputStream(WriteBuffer & ostr_, const Block & sample_)
|
|
|
|
|
: VerticalRowOutputStream(ostr_, sample_) {}
|
|
|
|
|
|
|
|
|
|
protected:
|
2016-02-16 16:39:39 +00:00
|
|
|
|
void writeValue(const IColumn & column, const IDataType & type, size_t row_num) const override;
|
2015-09-20 04:04:52 +00:00
|
|
|
|
};
|
|
|
|
|
|
2011-11-28 04:05:53 +00:00
|
|
|
|
}
|
|
|
|
|
|