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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
|
#pragma once
#include "node.h"
#include "context.h"
namespace NSQLTranslationV1 {
class TObjectOperatorContext {
protected:
TScopedStatePtr Scoped_;
public:
TString ServiceId;
TDeferredAtom Cluster;
TObjectOperatorContext(const TObjectOperatorContext& baseItem) = default;
TObjectOperatorContext(TScopedStatePtr scoped);
};
class TObjectProcessorImpl: public TAstListNode, public TObjectOperatorContext {
using TBase = TAstListNode;
TString ObjectId_;
TString TypeId_;
INode::TPtr BuildKeys() const;
protected:
virtual INode::TPtr BuildOptions() const = 0;
virtual INode::TPtr FillFeatures(INode::TPtr options) const = 0;
public:
TObjectProcessorImpl(TPosition pos, const TString& objectId, const TString& typeId, const TObjectOperatorContext& context);
bool DoInit(TContext& ctx, ISource* src) override;
TPtr DoClone() const final;
};
class TObjectProcessorWithFeatures: public TObjectProcessorImpl {
protected:
using TFeatureMap = std::map<TString, TDeferredAtom>;
private:
using TBase = TObjectProcessorImpl;
TFeatureMap Features_;
protected:
INode::TPtr FillFeatures(INode::TPtr options) const override;
public:
bool DoInit(TContext& ctx, ISource* src) override;
TObjectProcessorWithFeatures(TPosition pos, const TString& objectId, const TString& typeId, const TObjectOperatorContext& context,
TFeatureMap&& features);
};
class TCreateObject final: public TObjectProcessorWithFeatures {
using TBase = TObjectProcessorWithFeatures;
bool ExistingOk_ = false;
bool ReplaceIfExists_ = false;
protected:
INode::TPtr BuildOptions() const final;
public:
TCreateObject(TPosition pos, const TString& objectId, const TString& typeId, const TObjectOperatorContext& context,
TFeatureMap&& features, bool existingOk, bool replaceIfExists);
};
class TUpsertObject final: public TObjectProcessorWithFeatures {
using TBase = TObjectProcessorWithFeatures;
protected:
INode::TPtr BuildOptions() const final;
public:
using TBase::TBase;
};
class TAlterObject final: public TObjectProcessorWithFeatures {
using TBase = TObjectProcessorWithFeatures;
std::set<TString> FeaturesToReset_;
bool MissingOk_ = false;
protected:
INode::TPtr BuildOptions() const final;
INode::TPtr FillFeatures(INode::TPtr options) const final;
public:
TAlterObject(TPosition pos, const TString& objectId, const TString& typeId, const TObjectOperatorContext& context,
TFeatureMap&& features, std::set<TString>&& featuresToReset, bool missingOk);
};
class TDropObject final: public TObjectProcessorWithFeatures {
using TBase = TObjectProcessorWithFeatures;
bool MissingOk_ = false;
protected:
INode::TPtr BuildOptions() const final;
public:
TDropObject(TPosition pos, const TString& objectId, const TString& typeId, const TObjectOperatorContext& context,
TFeatureMap&& features, bool missingOk);
};
} // NSQLTranslationV1
|