ClickHouse/src/Parsers/ASTShowColumnsQuery.cpp

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

53 lines
1.8 KiB
C++
Raw Normal View History

#include <Parsers/ASTShowColumnsQuery.h>
#include <iomanip>
#include <Common/quoteString.h>
#include <IO/Operators.h>
namespace DB
{
ASTPtr ASTShowColumnsQuery::clone() const
{
auto res = std::make_shared<ASTShowColumnsQuery>(*this);
res->children.clear();
cloneOutputOptions(*res);
return res;
}
void ASTShowColumnsQuery::formatQueryImpl(const FormatSettings & settings, FormatState & state, FormatStateStacked frame) const
{
settings.ostr << (settings.hilite ? hilite_keyword : "")
<< "SHOW "
<< (extended ? "EXTENDED " : "")
<< (full ? "FULL " : "")
<< "COLUMNS"
<< (settings.hilite ? hilite_none : "");
2023-03-31 13:53:52 +00:00
settings.ostr << (settings.hilite ? hilite_keyword : "") << " FROM " << (settings.hilite ? hilite_none : "") << backQuoteIfNeed(from_table);
if (!from_database.empty())
settings.ostr << (settings.hilite ? hilite_keyword : "") << " FROM " << (settings.hilite ? hilite_none : "") << backQuoteIfNeed(from_database);
if (!like.empty())
settings.ostr << (settings.hilite ? hilite_keyword : "")
2023-03-31 13:53:52 +00:00
<< (not_like ? " NOT" : "")
2023-03-28 21:01:17 +00:00
<< (case_insensitive_like ? " ILIKE " : " LIKE")
<< (settings.hilite ? hilite_none : "")
<< DB::quote << like;
if (where_expression)
{
settings.ostr << (settings.hilite ? hilite_keyword : "") << " WHERE " << (settings.hilite ? hilite_none : "");
where_expression->formatImpl(settings, state, frame);
}
if (limit_length)
{
settings.ostr << (settings.hilite ? hilite_keyword : "") << " LIMIT " << (settings.hilite ? hilite_none : "");
limit_length->formatImpl(settings, state, frame);
}
}
}