1#pragma once
2
3#include <Parsers/ASTWithAlias.h>
4
5
6namespace DB
7{
8
9/// Parameter in query with name and type of substitution ({name:type}).
10/// Example: SELECT * FROM table WHERE id = {pid:UInt16}.
11class ASTQueryParameter : public ASTWithAlias
12{
13public:
14 String name;
15 String type;
16
17 ASTQueryParameter(const String & name_, const String & type_) : name(name_), type(type_) {}
18
19 /** Get the text that identifies this element. */
20 String getID(char delim) const override { return String("QueryParameter") + delim + name + ':' + type; }
21
22 ASTPtr clone() const override { return std::make_shared<ASTQueryParameter>(*this); }
23
24protected:
25 void formatImplWithoutAlias(const FormatSettings & settings, FormatState &, FormatStateStacked) const override;
26 void appendColumnNameImpl(WriteBuffer & ostr) const override;
27};
28
29}
30