mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-04 21:42:39 +00:00
35 lines
694 B
C++
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);
|
|
}
|
|
|
|
}
|
|
|
|
|