2019-06-29 16:58:32 +00:00
|
|
|
#include <iomanip>
|
|
|
|
#include <Parsers/ASTShowTablesQuery.h>
|
|
|
|
|
|
|
|
|
|
|
|
namespace DB
|
|
|
|
{
|
|
|
|
|
|
|
|
ASTPtr ASTShowTablesQuery::clone() const
|
|
|
|
{
|
|
|
|
auto res = std::make_shared<ASTShowTablesQuery>(*this);
|
|
|
|
res->children.clear();
|
|
|
|
cloneOutputOptions(*res);
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
2019-09-15 16:07:27 +00:00
|
|
|
void ASTShowTablesQuery::formatQueryImpl(const FormatSettings & settings, FormatState & state, FormatStateStacked frame) const
|
2019-06-29 16:58:32 +00:00
|
|
|
{
|
|
|
|
if (databases)
|
|
|
|
{
|
|
|
|
settings.ostr << (settings.hilite ? hilite_keyword : "") << "SHOW DATABASES" << (settings.hilite ? hilite_none : "");
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
settings.ostr << (settings.hilite ? hilite_keyword : "") << "SHOW " << (temporary ? "TEMPORARY " : "") << "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 : "") << " LIKE " << (settings.hilite ? hilite_none : "")
|
|
|
|
<< std::quoted(like, '\'');
|
2019-09-15 16:07:27 +00:00
|
|
|
|
|
|
|
if (limit_length)
|
|
|
|
{
|
|
|
|
settings.ostr << (settings.hilite ? hilite_keyword : "") << " LIMIT " << (settings.hilite ? hilite_none : "");
|
|
|
|
limit_length->formatImpl(settings, state, frame);
|
|
|
|
}
|
2019-06-29 16:58:32 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|