Place setting into separate struct

This commit is contained in:
avogar 2023-09-13 13:19:05 +00:00
parent f265514ced
commit 1480c8ad30
7 changed files with 11 additions and 8 deletions

View File

@ -97,7 +97,7 @@ void SerializationCustomSimpleText::serializeTextXML(const IColumn & column, siz
void SerializationCustomSimpleText::serializeTextMarkdown( void SerializationCustomSimpleText::serializeTextMarkdown(
const IColumn & column, size_t row_num, WriteBuffer & ostr, const FormatSettings & settings) const const IColumn & column, size_t row_num, WriteBuffer & ostr, const FormatSettings & settings) const
{ {
if (settings.output_format_markdown_escape_special_characters) if (settings.markdown.escape_special_characters)
writeMarkdownEscapedString(serializeToString(*this, column, row_num, settings), ostr); writeMarkdownEscapedString(serializeToString(*this, column, row_num, settings), ostr);
else else
writeEscapedString(serializeToString(*this, column, row_num, settings), ostr); writeEscapedString(serializeToString(*this, column, row_num, settings), ostr);

View File

@ -115,7 +115,7 @@ template <typename Type>
void SerializationEnum<Type>::serializeTextMarkdown( void SerializationEnum<Type>::serializeTextMarkdown(
const IColumn & column, size_t row_num, WriteBuffer & ostr, const FormatSettings & settings) const const IColumn & column, size_t row_num, WriteBuffer & ostr, const FormatSettings & settings) const
{ {
if (settings.output_format_markdown_escape_special_characters) if (settings.markdown.escape_special_characters)
writeMarkdownEscapedString(this->getNameForValue(assert_cast<const ColumnType &>(column).getData()[row_num]).toView(), ostr); writeMarkdownEscapedString(this->getNameForValue(assert_cast<const ColumnType &>(column).getData()[row_num]).toView(), ostr);
else else
serializeTextEscaped(column, row_num, ostr, settings); serializeTextEscaped(column, row_num, ostr, settings);

View File

@ -213,7 +213,7 @@ void SerializationFixedString::deserializeTextCSV(IColumn & column, ReadBuffer &
void SerializationFixedString::serializeTextMarkdown( void SerializationFixedString::serializeTextMarkdown(
const DB::IColumn & column, size_t row_num, DB::WriteBuffer & ostr, const DB::FormatSettings & settings) const const DB::IColumn & column, size_t row_num, DB::WriteBuffer & ostr, const DB::FormatSettings & settings) const
{ {
if (settings.output_format_markdown_escape_special_characters) if (settings.markdown.escape_special_characters)
{ {
writeMarkdownEscapedString( writeMarkdownEscapedString(
reinterpret_cast<const char *>(&(assert_cast<const ColumnFixedString &>(column).getChars()[n * row_num])), n, ostr); reinterpret_cast<const char *>(&(assert_cast<const ColumnFixedString &>(column).getChars()[n * row_num])), n, ostr);

View File

@ -517,7 +517,7 @@ template <typename Parser>
void SerializationObject<Parser>::serializeTextMarkdown( void SerializationObject<Parser>::serializeTextMarkdown(
const IColumn & column, size_t row_num, WriteBuffer & ostr, const FormatSettings & settings) const const IColumn & column, size_t row_num, WriteBuffer & ostr, const FormatSettings & settings) const
{ {
if (settings.output_format_markdown_escape_special_characters) if (settings.markdown.escape_special_characters)
{ {
WriteBufferFromOwnString ostr_str; WriteBufferFromOwnString ostr_str;
serializeTextImpl(column, row_num, ostr_str, settings); serializeTextImpl(column, row_num, ostr_str, settings);

View File

@ -364,7 +364,7 @@ void SerializationString::deserializeTextCSV(IColumn & column, ReadBuffer & istr
void SerializationString::serializeTextMarkdown( void SerializationString::serializeTextMarkdown(
const IColumn & column, size_t row_num, WriteBuffer & ostr, const FormatSettings & settings) const const IColumn & column, size_t row_num, WriteBuffer & ostr, const FormatSettings & settings) const
{ {
if (settings.output_format_markdown_escape_special_characters) if (settings.markdown.escape_special_characters)
writeMarkdownEscapedString(assert_cast<const ColumnString &>(column).getDataAt(row_num).toView(), ostr); writeMarkdownEscapedString(assert_cast<const ColumnString &>(column).getDataAt(row_num).toView(), ostr);
else else
serializeTextEscaped(column, row_num, ostr, settings); serializeTextEscaped(column, row_num, ostr, settings);

View File

@ -213,7 +213,7 @@ FormatSettings getFormatSettings(ContextPtr context, const Settings & settings)
format_settings.try_infer_integers = settings.input_format_try_infer_integers; format_settings.try_infer_integers = settings.input_format_try_infer_integers;
format_settings.try_infer_dates = settings.input_format_try_infer_dates; format_settings.try_infer_dates = settings.input_format_try_infer_dates;
format_settings.try_infer_datetimes = settings.input_format_try_infer_datetimes; format_settings.try_infer_datetimes = settings.input_format_try_infer_datetimes;
format_settings.output_format_markdown_escape_special_characters = settings.output_format_markdown_escape_special_characters; format_settings.markdown.escape_special_characters = settings.output_format_markdown_escape_special_characters;
format_settings.bson.output_string_as_string = settings.output_format_bson_string_as_string; format_settings.bson.output_string_as_string = settings.output_format_bson_string_as_string;
format_settings.bson.skip_fields_with_unsupported_types_in_schema_inference = settings.input_format_bson_skip_fields_with_unsupported_types_in_schema_inference; format_settings.bson.skip_fields_with_unsupported_types_in_schema_inference = settings.input_format_bson_skip_fields_with_unsupported_types_in_schema_inference;
format_settings.max_binary_string_size = settings.format_binary_max_string_size; format_settings.max_binary_string_size = settings.format_binary_max_string_size;

View File

@ -46,8 +46,6 @@ struct FormatSettings
bool try_infer_dates = false; bool try_infer_dates = false;
bool try_infer_datetimes = false; bool try_infer_datetimes = false;
bool output_format_markdown_escape_special_characters = false;
enum class DateTimeInputFormat enum class DateTimeInputFormat
{ {
Basic, /// Default format for fast parsing: YYYY-MM-DD hh:mm:ss (ISO-8601 without fractional part and timezone) or NNNNNNNNNN unix timestamp. Basic, /// Default format for fast parsing: YYYY-MM-DD hh:mm:ss (ISO-8601 without fractional part and timezone) or NNNNNNNNNN unix timestamp.
@ -407,6 +405,11 @@ struct FormatSettings
{ {
bool allow_types_conversion = true; bool allow_types_conversion = true;
} native; } native;
struct
{
bool escape_special_characters = false;
} markdown;
}; };
} }