ClickHouse/src/Parsers/ASTQueryParameter.h

30 lines
838 B
C++
Raw Normal View History

2019-05-18 21:07:23 +00:00
#pragma once
#include <Parsers/ASTWithAlias.h>
namespace DB
{
2019-05-25 13:43:52 +00:00
/// Parameter in query with name and type of substitution ({name:type}).
/// Example: SELECT * FROM table WHERE id = {pid:UInt16}.
2019-05-18 21:07:23 +00:00
class ASTQueryParameter : public ASTWithAlias
{
public:
2019-05-25 13:43:52 +00:00
String name;
String type;
2019-05-18 21:07:23 +00:00
ASTQueryParameter(const String & name_, const String & type_) : name(name_), type(type_) {}
/** Get the text that identifies this element. */
2019-06-14 17:15:30 +00:00
String getID(char delim) const override { return String("QueryParameter") + delim + name + ':' + type; }
2019-05-18 21:07:23 +00:00
2019-05-18 23:57:26 +00:00
ASTPtr clone() const override { return std::make_shared<ASTQueryParameter>(*this); }
2019-05-18 21:07:23 +00:00
protected:
void formatImplWithoutAlias(const FormatSettings & settings, FormatState &, FormatStateStacked) const override;
void appendColumnNameImpl(WriteBuffer & ostr) const override;
};
}