aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/clickhouse/src/Parsers/ASTTransactionControl.h
blob: fb0058144dd9c92b05395d334c6bb7b21ee4cfba (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
#pragma once
#include <Parsers/IAST.h>

namespace DB
{

/// Common AST for TCL queries
class ASTTransactionControl : public IAST
{
public:
    enum QueryType
    {
        BEGIN,
        COMMIT,
        ROLLBACK,
        SET_SNAPSHOT,
    };

    QueryType action;

    UInt64 snapshot;    /// For SET TRANSACTION SNAPSHOT ...

    ASTTransactionControl(QueryType action_) : action(action_) {}

    String getID(char /*delimiter*/) const override { return "ASTTransactionControl"; }
    ASTPtr clone() const override { return std::make_shared<ASTTransactionControl>(*this); }

    void formatImpl(const FormatSettings & format, FormatState & /*state*/, FormatStateStacked /*frame*/) const override;
    void updateTreeHashImpl(SipHash & hash_state) const override;

    QueryKind getQueryKind() const override;
};

}