aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/clickhouse/src/Parsers/ParserSetQuery.h
blob: 4d3803e78b4b0542d50461b8b08cac94eaca8509 (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
#pragma once

#include <Parsers/IParserBase.h>
#include <Parsers/ExpressionElementParsers.h>


namespace DB
{

struct SettingChange;

/** Query like this:
  * SET name1 = value1, name2 = value2, ...
  */
class ParserSetQuery : public IParserBase
{
public:
    using Parameter = std::pair<std::string, std::string>;

    explicit ParserSetQuery(bool parse_only_internals_ = false) : parse_only_internals(parse_only_internals_) {}

    static bool parseNameValuePair(SettingChange & change, IParser::Pos & pos, Expected & expected);

    static bool parseNameValuePairWithParameterOrDefault(SettingChange & change,
                                                         String & default_settings,
                                                         Parameter & parameter,
                                                         IParser::Pos & pos,
                                                         Expected & expected);

protected:
    const char * getName() const override { return "SET query"; }
    bool parseImpl(Pos & pos, ASTPtr & node, Expected & expected) override;
    /// Parse the list `name = value` pairs, without SET.
    bool parse_only_internals;
};

}