2012-07-12 19:49:22 +00:00
|
|
|
#pragma once
|
|
|
|
|
2017-04-01 09:19:00 +00:00
|
|
|
#include <Parsers/IAST.h>
|
2019-10-08 18:42:22 +00:00
|
|
|
#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:
|
2017-04-01 07:20:54 +00:00
|
|
|
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. */
|
2018-12-07 12:34:40 +00:00
|
|
|
String getID(char delim) const override { return "UseQuery" + (delim + database); }
|
2012-07-12 19:49:22 +00:00
|
|
|
|
2017-04-01 07:20:54 +00:00
|
|
|
ASTPtr clone() const override { return std::make_shared<ASTUseQuery>(*this); }
|
2015-08-06 03:26:27 +00:00
|
|
|
|
|
|
|
protected:
|
2017-12-01 18:36:55 +00:00
|
|
|
void formatImpl(const FormatSettings & settings, FormatState &, FormatStateStacked) const override
|
2017-04-01 07:20:54 +00:00
|
|
|
{
|
|
|
|
settings.ostr << (settings.hilite ? hilite_keyword : "") << "USE " << (settings.hilite ? hilite_none : "") << backQuoteIfNeed(database);
|
|
|
|
return;
|
|
|
|
}
|
2012-07-12 19:49:22 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|