mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-17 03:42:48 +00:00
64 lines
2.1 KiB
C++
64 lines
2.1 KiB
C++
#pragma once
|
|
#include <DataTypes/IDataType.h>
|
|
|
|
namespace DB
|
|
{
|
|
|
|
/// Helper class to define same IDataType text (de)serialization for all the variants (escaped, quoted, JSON, CSV).
|
|
/// You need to define serializeText() and deserializeText() in derived class.
|
|
class DataTypeWithSimpleSerialization : public IDataType
|
|
{
|
|
protected:
|
|
DataTypeWithSimpleSerialization()
|
|
{}
|
|
|
|
void serializeTextEscaped(const IColumn & column, size_t row_num, WriteBuffer & ostr, const FormatSettings & settings) const override
|
|
{
|
|
serializeText(column, row_num, ostr, settings);
|
|
}
|
|
|
|
void serializeTextQuoted(const IColumn & column, size_t row_num, WriteBuffer & ostr, const FormatSettings & settings) const override
|
|
{
|
|
serializeText(column, row_num, ostr, settings);
|
|
}
|
|
|
|
void serializeTextJSON(const IColumn & column, size_t row_num, WriteBuffer & ostr, const FormatSettings & settings) const override
|
|
{
|
|
serializeText(column, row_num, ostr, settings);
|
|
}
|
|
|
|
void serializeTextCSV(const IColumn & column, size_t row_num, WriteBuffer & ostr, const FormatSettings & settings) const override
|
|
{
|
|
serializeText(column, row_num, ostr, settings);
|
|
}
|
|
|
|
void deserializeWholeText(IColumn & column, ReadBuffer & istr, const FormatSettings & settings) const override
|
|
{
|
|
deserializeText(column, istr, settings);
|
|
}
|
|
|
|
void deserializeTextEscaped(IColumn & column, ReadBuffer & istr, const FormatSettings & settings) const override
|
|
{
|
|
deserializeText(column, istr, settings);
|
|
}
|
|
|
|
void deserializeTextQuoted(IColumn & column, ReadBuffer & istr, const FormatSettings & settings) const override
|
|
{
|
|
deserializeText(column, istr, settings);
|
|
}
|
|
|
|
void deserializeTextJSON(IColumn & column, ReadBuffer & istr, const FormatSettings & settings) const override
|
|
{
|
|
deserializeText(column, istr, settings);
|
|
}
|
|
|
|
void deserializeTextCSV(IColumn & column, ReadBuffer & istr, const FormatSettings & settings) const override
|
|
{
|
|
deserializeText(column, istr, settings);
|
|
}
|
|
|
|
virtual void deserializeText(IColumn & column, ReadBuffer & istr, const FormatSettings &) const = 0;
|
|
};
|
|
|
|
}
|