ClickHouse/src/Parsers/ASTNameTypePair.cpp
2020-11-09 19:05:40 +03:00

35 lines
694 B
C++

#include <Parsers/ASTNameTypePair.h>
#include <Common/quoteString.h>
#include <IO/Operators.h>
namespace DB
{
ASTPtr ASTNameTypePair::clone() const
{
auto res = std::make_shared<ASTNameTypePair>(*this);
res->children.clear();
if (type)
{
res->type = type->clone();
res->children.push_back(res->type);
}
return res;
}
void ASTNameTypePair::formatImpl(const FormatSettings & settings, FormatState & state, FormatStateStacked frame) const
{
std::string indent_str = settings.one_line ? "" : std::string(4 * frame.indent, ' ');
settings.ostr << indent_str << backQuoteIfNeed(name) << ' ';
type->formatImpl(settings, state, frame);
}
}