未验证 提交 8de41586 编写于 作者: A Alexander Kuzmenkov 提交者: GitHub

Merge pull request #17206 from ClickHouse/aku/noescape

Remove escaping from toString(std::string)
......@@ -859,15 +859,15 @@ template <typename T>
inline std::enable_if_t<std::is_floating_point_v<T>, void>
writeText(const T & x, WriteBuffer & buf) { writeFloatText(x, buf); }
inline void writeText(const String & x, WriteBuffer & buf) { writeEscapedString(x, buf); }
inline void writeText(const String & x, WriteBuffer & buf) { writeString(x.c_str(), x.size(), buf); }
/// Implemented as template specialization (not function overload) to avoid preference over templates on arithmetic types above.
template <> inline void writeText<bool>(const bool & x, WriteBuffer & buf) { writeBoolText(x, buf); }
/// unlike the method for std::string
/// assumes here that `x` is a null-terminated string.
inline void writeText(const char * x, WriteBuffer & buf) { writeEscapedString(x, strlen(x), buf); }
inline void writeText(const char * x, size_t size, WriteBuffer & buf) { writeEscapedString(x, size, buf); }
inline void writeText(const char * x, WriteBuffer & buf) { writeCString(x, buf); }
inline void writeText(const char * x, size_t size, WriteBuffer & buf) { writeString(x, size, buf); }
inline void writeText(const DayNum & x, WriteBuffer & buf) { writeDateText(LocalDate(x), buf); }
inline void writeText(const LocalDate & x, WriteBuffer & buf) { writeDateText(x, buf); }
......
......@@ -63,34 +63,34 @@ void ColumnDescription::writeText(WriteBuffer & buf) const
{
writeBackQuotedString(name, buf);
writeChar(' ', buf);
DB::writeText(type->getName(), buf);
writeEscapedString(type->getName(), buf);
if (default_desc.expression)
{
writeChar('\t', buf);
DB::writeText(DB::toString(default_desc.kind), buf);
writeChar('\t', buf);
DB::writeText(queryToString(default_desc.expression), buf);
writeEscapedString(queryToString(default_desc.expression), buf);
}
if (!comment.empty())
{
writeChar('\t', buf);
DB::writeText("COMMENT ", buf);
DB::writeText(queryToString(ASTLiteral(Field(comment))), buf);
writeEscapedString(queryToString(ASTLiteral(Field(comment))), buf);
}
if (codec)
{
writeChar('\t', buf);
DB::writeText(queryToString(codec), buf);
writeEscapedString(queryToString(codec), buf);
}
if (ttl)
{
writeChar('\t', buf);
DB::writeText("TTL ", buf);
DB::writeText(queryToString(ttl), buf);
writeEscapedString(queryToString(ttl), buf);
}
writeChar('\n', buf);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册