mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-01 20:12:02 +00:00
97f2a2213e
* Move some code outside dbms/src folder * Fix paths
44 lines
1.1 KiB
C++
44 lines
1.1 KiB
C++
#include <Parsers/ASTSetRoleQuery.h>
|
|
#include <Parsers/ASTExtendedRoleSet.h>
|
|
#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);
|
|
}
|
|
}
|