blob: a37a31ae38e91664d501dd325c9da122c42b1edf (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
#pragma once
#include <Parsers/IAST.h>
namespace DB
{
/// Part of the ALTER UPDATE statement of the form: column = expr
class ASTAssignment : public IAST
{
public:
String column_name;
ASTPtr expression() const
{
return children.at(0);
}
String getID(char delim) const override { return "Assignment" + (delim + column_name); }
ASTPtr clone() const override
{
auto res = std::make_shared<ASTAssignment>(*this);
res->children = { expression()->clone() };
return res;
}
protected:
void formatImpl(const FormatSettings & settings, FormatState & state, FormatStateStacked frame) const override
{
settings.ostr << (settings.hilite ? hilite_identifier : "");
settings.writeIdentifier(column_name);
settings.ostr << (settings.hilite ? hilite_none : "");
settings.ostr << (settings.hilite ? hilite_operator : "") << " = " << (settings.hilite ? hilite_none : "");
expression()->formatImpl(settings, state, frame);
}
};
}
|