| 1 | #pragma once |
|---|---|
| 2 | |
| 3 | #include <Parsers/IAST.h> |
| 4 | #include <Common/quoteString.h> |
| 5 | |
| 6 | |
| 7 | namespace DB |
| 8 | { |
| 9 | |
| 10 | |
| 11 | /** USE query |
| 12 | */ |
| 13 | class ASTUseQuery : public IAST |
| 14 | { |
| 15 | public: |
| 16 | String database; |
| 17 | |
| 18 | /** Get the text that identifies this element. */ |
| 19 | String getID(char delim) const override { return "UseQuery"+ (delim + database); } |
| 20 | |
| 21 | ASTPtr clone() const override { return std::make_shared<ASTUseQuery>(*this); } |
| 22 | |
| 23 | protected: |
| 24 | void formatImpl(const FormatSettings & settings, FormatState &, FormatStateStacked) const override |
| 25 | { |
| 26 | settings.ostr << (settings.hilite ? hilite_keyword : "") << "USE "<< (settings.hilite ? hilite_none : "") << backQuoteIfNeed(database); |
| 27 | return; |
| 28 | } |
| 29 | }; |
| 30 | |
| 31 | } |
| 32 |