2016-06-07 08:23:15 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <DB/Parsers/IAST.h>
|
|
|
|
|
|
|
|
|
|
|
|
namespace DB
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
/** USE запрос
|
|
|
|
*/
|
|
|
|
class ASTUseQuery : public IAST
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
String database;
|
|
|
|
|
|
|
|
ASTUseQuery() = default;
|
|
|
|
ASTUseQuery(const StringRange range_) : IAST(range_) {}
|
|
|
|
|
|
|
|
/** Получить текст, который идентифицирует этот элемент. */
|
|
|
|
String getID() const override { return "UseQuery_" + database; };
|
|
|
|
|
2016-06-08 13:08:20 +00:00
|
|
|
ASTPtr clone() const override { return std::make_shared<ASTUseQuery>(*this); }
|
2016-06-07 08:23:15 +00:00
|
|
|
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|