-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathql_treeplandelete.h
88 lines (63 loc) · 2.21 KB
/
ql_treeplandelete.h
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
#ifndef QL_TREEPLANDELETE_H
#define QL_TREEPLANDELETE_H
#include <vector>
#include <string>
#include "redbase.h"
#include "sm.h"
#include "parser.h"
#include "printer.h"
#include "ql_iterator.h"
class QL_TreePlanDelete
{
public:
enum NodeOperation {
COMPARISON,
SELECT
};
enum ScanStatus {
SCANOPENED,
SCANCLOSED
};
// constructor & destructor
QL_TreePlanDelete(SM_Manager *ipSmm, IX_Manager *ipIxm, RM_Manager *ipRmm);
~QL_TreePlanDelete();
// getters
ScanStatus getScanStatus() { return _scanStatus; }
// setters
void SetNodeOperation(NodeOperation iNodeOperation);
void SetLeftChild(QL_TreePlanDelete *ipTreePlan);
// builder
RC BuildFromQuery(const std::vector<RelAttr> &selAttrs,
const std::vector<const char*> &relations,
const std::vector<Condition> &conditions);
RC BuildFromComparison(const std::vector<RelAttr> &selAttrs,
const std::vector<const char*> &relations,
const std::vector<Condition> &conditions);
RC BuildFromSelect(const std::vector<RelAttr> &selAttrs,
const std::vector<const char*> &relations,
const std::vector<Condition> &conditions);
// operator
RC GetNext(RM_Record &oRecord);
void Print(char prefix, int level);
private:
RC PerformComparison(RM_Record &oRecord);
RC PerformSelect(RM_Record &oRecord);
RC ComputeAttributesStructure(const std::vector<RelAttr> &selAttrs, int &nNodeAttributes, DataAttrInfo *&nodeAttributes, int &bufferSize);
RC IsAttributeInList(const int nNodeAttributes, const DataAttrInfo *nodeAttributes, const DataAttrInfo &attribute, int &index);
void Padding(char ch, int n);
SM_Manager *_pSmm;
IX_Manager *_pIxm;
RM_Manager *_pRmm;
QL_TreePlanDelete *_pLc;
NodeOperation _nodeOperation;
int _bufferSize;
int _nNodeAttributes;
DataAttrInfo *_nodeAttributes;
int _nOperationAttributes;
DataAttrInfo *_operationAttributes;
std::string _sRelName;
std::vector<Condition> _conditions;
ScanStatus _scanStatus;
QL_Iterator *_pScanIterator;
};
#endif // QL_TREEPLANDELETE_H