-
Notifications
You must be signed in to change notification settings - Fork 1
/
ColumnBase.h
57 lines (45 loc) · 1.28 KB
/
ColumnBase.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
/*
* ColumnBase.h
*
* Created on: Sep 23, 2016
* Author: duclv
*/
#ifndef COLUMNBASE_H_
#define COLUMNBASE_H_
#include <string>
namespace std {
class ColumnBase {
public:
enum COLUMN_TYPE {intType, charType, varcharType};
enum OP_TYPE {equalOp, neOp, ltOp, leOp, gtOp, geOp, containOp};
private:
string name;
COLUMN_TYPE type;
int size;
bool isPrimaryKey = false; // default is false
bool createInvertedIndex = false; // create inverted index for this column ?
public:
ColumnBase();
virtual ~ColumnBase();
string getName();
void setName(string nameValue);
COLUMN_TYPE getType();
void setType(COLUMN_TYPE typeValue);
int getSize();
void setSize(int sizeValue);
bool primaryKey();
void setPrimaryKey(bool isPrimaryKey);
bool isCreateInvertedIndex() {return createInvertedIndex; }
void setCreateInvertedIndex(bool createInvertedIndex) {this->createInvertedIndex = createInvertedIndex; }
static OP_TYPE sToOp(string op) {
if (op == ">") return OP_TYPE::gtOp;
else if (op == ">=") return OP_TYPE::geOp;
else if (op == "<") return OP_TYPE::ltOp;
else if (op == "<=") return OP_TYPE::leOp;
else if (op == "=") return OP_TYPE::equalOp;
else if (op == "<>") return OP_TYPE::neOp;
return OP_TYPE::containOp;
}
};
} /* namespace std */
#endif /* COLUMNBASE_H_ */