Merge pull request #49558 from ClickHouse/rs/writeAnyEscapedString

Fix writeAnyEscapedString if quote_character is a meta character
This commit is contained in:
Robert Schulze 2023-05-06 15:29:32 +02:00 committed by GitHub
commit a1c98303a7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -316,6 +316,15 @@ void writeAnyEscapedString(const char * begin, const char * end, WriteBuffer & b
pos = next_pos;
switch (*pos)
{
case quote_character:
{
if constexpr (escape_quote_with_quote)
writeChar(quote_character, buf);
else
writeChar('\\', buf);
writeChar(quote_character, buf);
break;
}
case '\b':
writeChar('\\', buf);
writeChar('b', buf);
@ -344,15 +353,6 @@ void writeAnyEscapedString(const char * begin, const char * end, WriteBuffer & b
writeChar('\\', buf);
writeChar('\\', buf);
break;
case quote_character:
{
if constexpr (escape_quote_with_quote)
writeChar(quote_character, buf);
else
writeChar('\\', buf);
writeChar(quote_character, buf);
break;
}
default:
writeChar(*pos, buf);
}