Make IAST::FormatSettings more regular

This commit is contained in:
Robert Schulze 2023-07-19 17:03:04 +00:00
parent 7a0de384d4
commit 35a4fabc2d
No known key found for this signature in database
GPG Key ID: 26703B55FB13728A
3 changed files with 6 additions and 5 deletions

View File

@ -170,7 +170,9 @@ size_t IAST::checkDepthImpl(size_t max_depth) const
String IAST::formatWithPossiblyHidingSensitiveData(size_t max_length, bool one_line, bool show_secrets) const
{
WriteBufferFromOwnString buf;
format({buf, one_line, show_secrets});
FormatSettings settings(buf, one_line);
settings.show_secrets = show_secrets;
format(settings);
return wipeSensitiveDataAndCutToLength(buf.str(), max_length);
}

View File

@ -198,10 +198,9 @@ public:
bool show_secrets = true; /// Show secret parts of the AST (e.g. passwords, encryption keys).
char nl_or_ws; /// Newline or whitespace.
FormatSettings(WriteBuffer & ostr_, bool one_line_, bool show_secrets_ = true)
FormatSettings(WriteBuffer & ostr_, bool one_line_)
: ostr(ostr_)
, one_line(one_line_)
, show_secrets(show_secrets_)
{
nl_or_ws = one_line ? ' ' : '\n';
}

View File

@ -6,9 +6,9 @@ namespace DB
void formatAST(const IAST & ast, WriteBuffer & buf, bool hilite, bool one_line, bool show_secrets)
{
IAST::FormatSettings settings(buf, one_line, show_secrets);
IAST::FormatSettings settings(buf, one_line);
settings.hilite = hilite;
settings.show_secrets = show_secrets;
ast.format(settings);
}