mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-09-19 16:20:50 +00:00
simplify formatting of astauth
This commit is contained in:
parent
cc13783acd
commit
5a2b0ea1cc
@ -160,9 +160,7 @@ void ASTAuthenticationData::formatImpl(const FormatSettings & settings, FormatSt
|
||||
auth_type_name = AuthenticationTypeInfo::get(*type).name;
|
||||
}
|
||||
|
||||
const char * identified_string = settings.additional_authentication_method ? " ADD IDENTIFIED" : " IDENTIFIED";
|
||||
|
||||
settings.ostr << (settings.hilite ? IAST::hilite_keyword : "") << identified_string << (settings.hilite ? IAST::hilite_none : "");
|
||||
settings.ostr << (settings.hilite ? IAST::hilite_keyword : "") << " IDENTIFIED" << (settings.hilite ? IAST::hilite_none : "");
|
||||
|
||||
if (!auth_type_name.empty())
|
||||
{
|
||||
|
@ -21,14 +21,16 @@ namespace
|
||||
|
||||
void formatAuthenticationData(const std::vector<std::shared_ptr<ASTAuthenticationData>> & authentication_methods, const IAST::FormatSettings & settings)
|
||||
{
|
||||
/*
|
||||
* The first authentication method must be formatted in the form of: `IDENTIFIED WITH xyz..`
|
||||
* The remaining ones shall contain the `ADD`: `ADD IDENTIFIED WITH`.
|
||||
* */
|
||||
authentication_methods[0]->format(settings);
|
||||
|
||||
auto settings_with_additional_authentication_method = settings;
|
||||
settings_with_additional_authentication_method.additional_authentication_method = true;
|
||||
|
||||
for (auto i = 1u; i < authentication_methods.size(); i++)
|
||||
for (std::size_t i = 1; i < authentication_methods.size(); i++)
|
||||
{
|
||||
authentication_methods[i]->format(settings_with_additional_authentication_method);
|
||||
settings.ostr << (settings.hilite ? IAST::hilite_keyword : "") << " ADD" << (settings.hilite ? IAST::hilite_none : "");
|
||||
authentication_methods[i]->format(settings);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -201,7 +201,6 @@ public:
|
||||
bool show_secrets; /// Show secret parts of the AST (e.g. passwords, encryption keys).
|
||||
char nl_or_ws; /// Newline or whitespace.
|
||||
LiteralEscapingStyle literal_escaping_style;
|
||||
bool additional_authentication_method;
|
||||
|
||||
explicit FormatSettings(
|
||||
WriteBuffer & ostr_,
|
||||
@ -210,8 +209,7 @@ public:
|
||||
bool always_quote_identifiers_ = false,
|
||||
IdentifierQuotingStyle identifier_quoting_style_ = IdentifierQuotingStyle::Backticks,
|
||||
bool show_secrets_ = true,
|
||||
LiteralEscapingStyle literal_escaping_style_ = LiteralEscapingStyle::Regular,
|
||||
bool additional_authentication_method_ = false)
|
||||
LiteralEscapingStyle literal_escaping_style_ = LiteralEscapingStyle::Regular)
|
||||
: ostr(ostr_)
|
||||
, one_line(one_line_)
|
||||
, hilite(hilite_)
|
||||
@ -220,7 +218,6 @@ public:
|
||||
, show_secrets(show_secrets_)
|
||||
, nl_or_ws(one_line ? ' ' : '\n')
|
||||
, literal_escaping_style(literal_escaping_style_)
|
||||
, additional_authentication_method(additional_authentication_method_)
|
||||
{
|
||||
}
|
||||
|
||||
@ -233,7 +230,6 @@ public:
|
||||
, show_secrets(other.show_secrets)
|
||||
, nl_or_ws(other.nl_or_ws)
|
||||
, literal_escaping_style(other.literal_escaping_style)
|
||||
, additional_authentication_method(other.additional_authentication_method)
|
||||
{
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user