#include #include namespace DB { namespace { void formatRenameTo(const String & new_name, const IAST::FormatSettings & settings) { settings.ostr << (settings.hilite ? IAST::hilite_keyword : "") << " RENAME TO " << (settings.hilite ? IAST::hilite_none : "") << quoteString(new_name); } } String ASTCreateRoleQuery::getID(char) const { return "CreateRoleQuery"; } ASTPtr ASTCreateRoleQuery::clone() const { return std::make_shared(*this); } void ASTCreateRoleQuery::formatImpl(const FormatSettings & settings, FormatState &, FormatStateStacked) const { settings.ostr << (settings.hilite ? hilite_keyword : "") << (alter ? "ALTER ROLE" : "CREATE ROLE") << (settings.hilite ? hilite_none : ""); if (if_exists) settings.ostr << (settings.hilite ? hilite_keyword : "") << " IF EXISTS" << (settings.hilite ? hilite_none : ""); else if (if_not_exists) settings.ostr << (settings.hilite ? hilite_keyword : "") << " IF NOT EXISTS" << (settings.hilite ? hilite_none : ""); else if (or_replace) settings.ostr << (settings.hilite ? hilite_keyword : "") << " OR REPLACE" << (settings.hilite ? hilite_none : ""); settings.ostr << " " << backQuoteIfNeed(name); if (!new_name.empty()) formatRenameTo(new_name, settings); } }