2020-02-17 02:59:56 +00:00
|
|
|
#include <Parsers/ASTSetRoleQuery.h>
|
2020-03-07 17:37:38 +00:00
|
|
|
#include <Parsers/ASTExtendedRoleSet.h>
|
2020-02-17 02:59:56 +00:00
|
|
|
#include <Common/quoteString.h>
|
|
|
|
|
|
|
|
|
|
|
|
namespace DB
|
|
|
|
{
|
|
|
|
String ASTSetRoleQuery::getID(char) const
|
|
|
|
{
|
|
|
|
return "SetRoleQuery";
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
ASTPtr ASTSetRoleQuery::clone() const
|
|
|
|
{
|
|
|
|
return std::make_shared<ASTSetRoleQuery>(*this);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void ASTSetRoleQuery::formatImpl(const FormatSettings & settings, FormatState &, FormatStateStacked) const
|
|
|
|
{
|
|
|
|
settings.ostr << (settings.hilite ? hilite_keyword : "");
|
|
|
|
switch (kind)
|
|
|
|
{
|
|
|
|
case Kind::SET_ROLE: settings.ostr << "SET ROLE"; break;
|
|
|
|
case Kind::SET_ROLE_DEFAULT: settings.ostr << "SET ROLE DEFAULT"; break;
|
|
|
|
case Kind::SET_DEFAULT_ROLE: settings.ostr << "SET DEFAULT ROLE"; break;
|
|
|
|
}
|
|
|
|
settings.ostr << (settings.hilite ? hilite_none : "");
|
|
|
|
|
|
|
|
if (kind == Kind::SET_ROLE_DEFAULT)
|
|
|
|
return;
|
|
|
|
|
|
|
|
settings.ostr << " ";
|
|
|
|
roles->format(settings);
|
|
|
|
|
|
|
|
if (kind == Kind::SET_ROLE)
|
|
|
|
return;
|
|
|
|
|
|
|
|
settings.ostr << (settings.hilite ? hilite_keyword : "") << " TO " << (settings.hilite ? hilite_none : "");
|
|
|
|
to_users->format(settings);
|
|
|
|
}
|
|
|
|
}
|