ClickHouse/src/Parsers/ASTUndropQuery.cpp
2024-03-08 21:27:56 +01:00

51 lines
1.2 KiB
C++

#include <Parsers/ASTUndropQuery.h>
#include <Common/quoteString.h>
#include <IO/Operators.h>
namespace DB
{
String ASTUndropQuery::getID(char delim) const
{
return "UndropQuery" + (delim + getDatabase()) + delim + getTable();
}
ASTPtr ASTUndropQuery::clone() const
{
auto res = std::make_shared<ASTUndropQuery>(*this);
cloneOutputOptions(*res);
cloneTableOptions(*res);
return res;
}
void ASTUndropQuery::formatQueryImpl(const FormatSettings & settings, FormatState & state, FormatStateStacked frame) const
{
settings.ostr << (settings.hilite ? hilite_keyword : "")
<< "UNDROP TABLE"
<< (settings.hilite ? hilite_none : "")
<< " ";
chassert(table);
if (table)
{
if (database)
{
database->formatImpl(settings, state, frame);
settings.ostr << '.';
}
chassert(table);
table->formatImpl(settings, state, frame);
}
if (uuid != UUIDHelpers::Nil)
settings.ostr << (settings.hilite ? hilite_keyword : "") << " UUID " << (settings.hilite ? hilite_none : "")
<< quoteString(toString(uuid));
formatOnCluster(settings);
}
}