2012-07-12 19:49:22 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <DB/Parsers/IAST.h>
|
|
|
|
|
|
|
|
|
|
|
|
namespace DB
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
/** USE запрос
|
|
|
|
*/
|
|
|
|
class ASTUseQuery : public IAST
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
String database;
|
|
|
|
|
2014-12-17 15:26:24 +00:00
|
|
|
ASTUseQuery() = default;
|
|
|
|
ASTUseQuery(const StringRange range_) : IAST(range_) {}
|
2015-08-06 03:26:27 +00:00
|
|
|
|
2012-07-12 19:49:22 +00:00
|
|
|
/** Получить текст, который идентифицирует этот элемент. */
|
2014-12-17 15:26:24 +00:00
|
|
|
String getID() const override { return "UseQuery_" + database; };
|
2012-07-12 19:49:22 +00:00
|
|
|
|
2014-12-17 15:26:24 +00:00
|
|
|
ASTPtr clone() const override { return new ASTUseQuery(*this); }
|
2015-08-06 03:26:27 +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;
|
|
|
|
}
|
2012-07-12 19:49:22 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|