2012-11-10 04:43:53 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <Poco/SharedPtr.h>
|
|
|
|
|
|
|
|
#include <DB/Core/Block.h>
|
|
|
|
#include <DB/IO/WriteBuffer.h>
|
|
|
|
#include <DB/DataStreams/IRowOutputStream.h>
|
|
|
|
|
|
|
|
|
|
|
|
namespace DB
|
|
|
|
{
|
|
|
|
|
|
|
|
/** Поток для вывода данных в бинарном построчном формате.
|
|
|
|
*/
|
|
|
|
class BinaryRowOutputStream : public IRowOutputStream
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
BinaryRowOutputStream(WriteBuffer & ostr_, const Block & sample_);
|
|
|
|
|
2014-11-08 23:52:18 +00:00
|
|
|
void writeField(const Field & field) override;
|
|
|
|
void writeRowEndDelimiter() override;
|
2012-11-10 04:43: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-10-29 20:38:37 +00:00
|
|
|
String getContentType() const override { return "application/octet-stream"; }
|
|
|
|
|
2012-11-10 04:43:53 +00:00
|
|
|
protected:
|
|
|
|
WriteBuffer & ostr;
|
|
|
|
const Block sample;
|
|
|
|
DataTypes data_types;
|
|
|
|
size_t field_number;
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|