-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapi.h
41 lines (36 loc) · 997 Bytes
/
api.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
#pragma once
enum Op {
EQ, NE, LT, GT, LE, GE
};
struct AttributeInfo {
Attribute attribute;
int attributeOrder;
};
struct Condition {
string attributeName;
int attributeOrder;
int type;
Op op;
string value;
};
struct IndexInfo {
string IndexName;
AttributeInfo attribute;
};
class api
{
public:
string CreateTable(Table t);
string DropTable(string name);
string CreateIndex(string inname,string tabname,string arrname);
string DropIndex(string inname);
string Select(string tableName, vector<string>& attributes, vector<Condition>& conditions);
//string Insert(string tabname,Tuple &v);
string Del(string tableName, vector<Condition>& conditions);
string Insert(string tableName, Tuple& tup);
private:
string singleCheck(string& value, int type);
string typeCheck(Tuple& Old,vector<Attribute>& attr, Tuple& New);
string nameCheck(string name);
int datacmp(const string& Lstr, const string& rstr, const int& type); //按类型返回比较值,-1表示小于,0表示等于,1表示大于
};