mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-26 09:32:01 +00:00
97f2a2213e
* Move some code outside dbms/src folder * Fix paths
50 lines
1.7 KiB
C++
50 lines
1.7 KiB
C++
#include <iomanip>
|
|
#include <Parsers/ASTShowTablesQuery.h>
|
|
#include <Common/quoteString.h>
|
|
|
|
|
|
namespace DB
|
|
{
|
|
|
|
ASTPtr ASTShowTablesQuery::clone() const
|
|
{
|
|
auto res = std::make_shared<ASTShowTablesQuery>(*this);
|
|
res->children.clear();
|
|
cloneOutputOptions(*res);
|
|
return res;
|
|
}
|
|
|
|
void ASTShowTablesQuery::formatQueryImpl(const FormatSettings & settings, FormatState & state, FormatStateStacked frame) const
|
|
{
|
|
if (databases)
|
|
{
|
|
settings.ostr << (settings.hilite ? hilite_keyword : "") << "SHOW DATABASES" << (settings.hilite ? hilite_none : "");
|
|
}
|
|
else
|
|
{
|
|
settings.ostr << (settings.hilite ? hilite_keyword : "") << "SHOW " << (temporary ? "TEMPORARY " : "") <<
|
|
(dictionaries ? "DICTIONARIES" : "TABLES") << (settings.hilite ? hilite_none : "");
|
|
|
|
if (!from.empty())
|
|
settings.ostr << (settings.hilite ? hilite_keyword : "") << " FROM " << (settings.hilite ? hilite_none : "")
|
|
<< backQuoteIfNeed(from);
|
|
|
|
if (!like.empty())
|
|
settings.ostr << (settings.hilite ? hilite_keyword : "") << (not_like ? " NOT" : "") << " LIKE " << (settings.hilite ? hilite_none : "")
|
|
<< std::quoted(like, '\'');
|
|
else 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);
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|