ClickHouse/dbms/Parsers/ASTUseQuery.h

32 lines
694 B
C++
Raw Normal View History

2012-07-12 19:49:22 +00:00
#pragma once
#include <Parsers/IAST.h>
#include <Common/quoteString.h>
2012-07-12 19:49:22 +00:00
namespace DB
{
2017-05-27 17:27:16 +00:00
/** USE query
2012-07-12 19:49:22 +00:00
*/
class ASTUseQuery : public IAST
{
public:
String database;
2012-07-12 19:49:22 +00:00
2017-05-27 17:27:16 +00:00
/** Get the text that identifies this element. */
String getID(char delim) const override { return "UseQuery" + (delim + database); }
2012-07-12 19:49:22 +00:00
ASTPtr clone() const override { return std::make_shared<ASTUseQuery>(*this); }
protected:
2017-12-01 18:36:55 +00:00
void formatImpl(const FormatSettings & settings, FormatState &, FormatStateStacked) const override
{
settings.ostr << (settings.hilite ? hilite_keyword : "") << "USE " << (settings.hilite ? hilite_none : "") << backQuoteIfNeed(database);
return;
}
2012-07-12 19:49:22 +00:00
};
}