2019-10-01 14:54:28 +00:00
|
|
|
#include <Parsers/ASTFunctionWithKeyValueArguments.h>
|
|
|
|
|
|
|
|
#include <Poco/String.h>
|
|
|
|
|
|
|
|
namespace DB
|
|
|
|
{
|
|
|
|
|
|
|
|
String ASTPair::getID(char) const
|
|
|
|
{
|
|
|
|
return "pair";
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
ASTPtr ASTPair::clone() const
|
|
|
|
{
|
|
|
|
auto res = std::make_shared<ASTPair>(*this);
|
|
|
|
res->children.clear();
|
|
|
|
|
|
|
|
if (second)
|
|
|
|
{
|
|
|
|
res->second = second;
|
|
|
|
res->children.push_back(second);
|
|
|
|
}
|
|
|
|
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void ASTPair::formatImpl(const FormatSettings & settings, FormatState & state, FormatStateStacked frame) const
|
|
|
|
{
|
|
|
|
settings.ostr << (settings.hilite ? hilite_keyword : "") << Poco::toUpper(first) << " " << (settings.hilite ? hilite_none : "");
|
2019-10-08 09:47:17 +00:00
|
|
|
|
|
|
|
if (second_with_brackets)
|
|
|
|
settings.ostr << (settings.hilite ? hilite_keyword : "") << "(";
|
|
|
|
|
2019-10-01 14:54:28 +00:00
|
|
|
second->formatImpl(settings, state, frame);
|
2019-10-08 09:47:17 +00:00
|
|
|
|
|
|
|
if (second_with_brackets)
|
|
|
|
settings.ostr << (settings.hilite ? hilite_keyword : "") << ")";
|
|
|
|
|
2019-10-01 14:54:28 +00:00
|
|
|
settings.ostr << (settings.hilite ? hilite_none : "");
|
|
|
|
}
|
|
|
|
|
|
|
|
String ASTFunctionWithKeyValueArguments::getID(char delim) const
|
|
|
|
{
|
|
|
|
return "FunctionWithKeyValueArguments " + (delim + name);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
ASTPtr ASTFunctionWithKeyValueArguments::clone() const
|
|
|
|
{
|
|
|
|
auto res = std::make_shared<ASTFunctionWithKeyValueArguments>(*this);
|
|
|
|
res->children.clear();
|
|
|
|
|
|
|
|
if (elements)
|
|
|
|
{
|
|
|
|
res->elements->clone();
|
|
|
|
res->children.push_back(res->elements);
|
|
|
|
}
|
|
|
|
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void ASTFunctionWithKeyValueArguments::formatImpl(const FormatSettings & settings, FormatState & state, FormatStateStacked frame) const
|
|
|
|
{
|
2020-04-06 11:02:17 +00:00
|
|
|
settings.ostr << (settings.hilite ? hilite_keyword : "") << Poco::toUpper(name) << (settings.hilite ? hilite_none : "") << (has_brackets ? "(" : "");
|
2019-10-01 14:54:28 +00:00
|
|
|
elements->formatImpl(settings, state, frame);
|
2020-04-06 11:02:17 +00:00
|
|
|
settings.ostr << (has_brackets ? ")" : "");
|
2019-10-01 14:54:28 +00:00
|
|
|
settings.ostr << (settings.hilite ? hilite_none : "");
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|