ClickHouse/dbms/include/DB/DataStreams/ValuesRowOutputStream.h

40 lines
784 B
C
Raw Normal View History

2011-10-30 05:19:41 +00:00
#pragma once
#include <Poco/SharedPtr.h>
2011-11-06 05:01:42 +00:00
#include <DB/Core/Block.h>
2011-10-30 05:19:41 +00:00
#include <DB/IO/WriteBuffer.h>
#include <DB/DataStreams/IRowOutputStream.h>
namespace DB
{
using Poco::SharedPtr;
2012-11-10 04:43:04 +00:00
/** Поток для вывода данных в формате VALUES (как в INSERT запросе).
2011-10-30 05:19:41 +00:00
*/
class ValuesRowOutputStream : public IRowOutputStream
{
public:
2011-11-06 05:01:42 +00:00
ValuesRowOutputStream(WriteBuffer & ostr_, const Block & sample_);
2011-10-30 05:19:41 +00:00
void writeField(const Field & field);
void writeFieldDelimiter();
void writeRowStartDelimiter();
void writeRowEndDelimiter();
void writeRowBetweenDelimiter();
2011-11-06 05:01:42 +00:00
RowOutputStreamPtr clone() { return new ValuesRowOutputStream(ostr, sample); }
2011-10-30 05:19:41 +00:00
private:
WriteBuffer & ostr;
2012-10-10 18:32:45 +00:00
const Block sample;
2011-11-06 05:01:42 +00:00
DataTypes data_types;
2011-10-30 05:19:41 +00:00
size_t field_number;
};
}