2011-08-15 21:50:08 +00:00
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include <DB/DataStreams/IBlockOutputStream.h>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
namespace DB
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
/** Пишет данные в tab-separated файл, но по столбцам, блоками.
|
|
|
|
|
* Блоки разделены двойным переводом строки.
|
|
|
|
|
* На каждой строке блока - данные одного столбца.
|
|
|
|
|
*/
|
|
|
|
|
class TabSeparatedBlockOutputStream : public IBlockOutputStream
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
TabSeparatedBlockOutputStream(WriteBuffer & ostr_) : ostr(ostr_) {}
|
|
|
|
|
|
|
|
|
|
/** Записать блок.
|
|
|
|
|
*/
|
|
|
|
|
void write(const Block & block);
|
|
|
|
|
|
2011-10-24 12:10:59 +00:00
|
|
|
|
BlockOutputStreamPtr clone() { return new TabSeparatedBlockOutputStream(ostr); }
|
|
|
|
|
|
2011-08-15 21:50:08 +00:00
|
|
|
|
private:
|
|
|
|
|
WriteBuffer & ostr;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
}
|