ClickHouse/dbms/src/Parsers/ASTUseQuery.h
2017-05-27 19:27:16 +02:00

34 lines
746 B
C++

#pragma once
#include <Parsers/IAST.h>
namespace DB
{
/** USE query
*/
class ASTUseQuery : public IAST
{
public:
String database;
ASTUseQuery() = default;
ASTUseQuery(const StringRange range_) : IAST(range_) {}
/** Get the text that identifies this element. */
String getID() const override { return "UseQuery_" + database; };
ASTPtr clone() const override { return std::make_shared<ASTUseQuery>(*this); }
protected:
void formatImpl(const FormatSettings & settings, FormatState & state, FormatStateStacked frame) const override
{
settings.ostr << (settings.hilite ? hilite_keyword : "") << "USE " << (settings.hilite ? hilite_none : "") << backQuoteIfNeed(database);
return;
}
};
}