2017-04-01 09:19:00 +00:00
|
|
|
#include <Parsers/ASTIdentifier.h>
|
|
|
|
#include <IO/WriteBufferFromOStream.h>
|
|
|
|
#include <IO/WriteHelpers.h>
|
2015-11-08 01:29:37 +00:00
|
|
|
|
|
|
|
|
|
|
|
namespace DB
|
|
|
|
{
|
|
|
|
|
2017-12-01 18:36:55 +00:00
|
|
|
void ASTIdentifier::formatImplWithoutAlias(const FormatSettings & settings, FormatState &, FormatStateStacked) const
|
2015-11-08 01:29:37 +00:00
|
|
|
{
|
2017-04-01 07:20:54 +00:00
|
|
|
auto format_element = [&](const String & name)
|
|
|
|
{
|
|
|
|
settings.ostr << (settings.hilite ? hilite_identifier : "");
|
|
|
|
|
|
|
|
WriteBufferFromOStream wb(settings.ostr, 32);
|
|
|
|
writeProbablyBackQuotedString(name, wb);
|
|
|
|
wb.next();
|
|
|
|
|
|
|
|
settings.ostr << (settings.hilite ? hilite_none : "");
|
|
|
|
};
|
|
|
|
|
2017-04-02 17:37:49 +00:00
|
|
|
/// A simple or compound identifier?
|
2017-04-01 07:20:54 +00:00
|
|
|
|
|
|
|
if (children.size() > 1)
|
|
|
|
{
|
|
|
|
for (size_t i = 0, size = children.size(); i < size; ++i)
|
|
|
|
{
|
|
|
|
if (i != 0)
|
|
|
|
settings.ostr << '.';
|
|
|
|
|
|
|
|
format_element(static_cast<const ASTIdentifier &>(*children[i].get()).name);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
format_element(name);
|
|
|
|
}
|
2015-11-08 01:29:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|