ClickHouse/src/Parsers/ASTConstraintDeclaration.cpp

30 lines
691 B
C++
Raw Normal View History

2019-05-25 14:07:45 +00:00
#include <Parsers/ASTConstraintDeclaration.h>
#include <Common/quoteString.h>
2020-11-09 16:05:40 +00:00
#include <IO/Operators.h>
2019-05-25 14:07:45 +00:00
2019-05-25 15:57:35 +00:00
namespace DB
{
2019-05-25 14:07:45 +00:00
ASTPtr ASTConstraintDeclaration::clone() const
{
auto res = std::make_shared<ASTConstraintDeclaration>();
res->name = name;
2021-01-03 15:02:00 +00:00
res->type = type;
2019-05-25 14:07:45 +00:00
if (expr)
res->set(res->expr, expr->clone());
return res;
}
void ASTConstraintDeclaration::formatImpl(const FormatSettings & s, FormatState & state, FormatStateStacked frame) const
{
s.ostr << backQuoteIfNeed(name);
2021-01-03 15:02:00 +00:00
s.ostr << (s.hilite ? hilite_keyword : "") << (type == Type::CHECK ? " CHECK " : " ASSUME ") << (s.hilite ? hilite_none : "");
2019-05-25 14:07:45 +00:00
expr->formatImpl(s, state, frame);
}
2019-05-25 15:57:35 +00:00
}