| 1 | #include <Parsers/ASTConstraintDeclaration.h> |
|---|---|
| 2 | #include <Common/quoteString.h> |
| 3 | |
| 4 | |
| 5 | namespace DB |
| 6 | { |
| 7 | |
| 8 | ASTPtr ASTConstraintDeclaration::clone() const |
| 9 | { |
| 10 | auto res = std::make_shared<ASTConstraintDeclaration>(); |
| 11 | |
| 12 | res->name = name; |
| 13 | |
| 14 | if (expr) |
| 15 | res->set(res->expr, expr->clone()); |
| 16 | |
| 17 | return res; |
| 18 | } |
| 19 | |
| 20 | void ASTConstraintDeclaration::formatImpl(const FormatSettings & s, FormatState & state, FormatStateStacked frame) const |
| 21 | { |
| 22 | frame.need_parens = false; |
| 23 | std::string indent_str = s.one_line ? "": std::string(4 * frame.indent, ' '); |
| 24 | |
| 25 | s.ostr << s.nl_or_ws << indent_str; |
| 26 | s.ostr << backQuoteIfNeed(name); |
| 27 | s.ostr << (s.hilite ? hilite_keyword : "") << " CHECK "<< (s.hilite ? hilite_none : ""); |
| 28 | expr->formatImpl(s, state, frame); |
| 29 | } |
| 30 | |
| 31 | } |
| 32 |