-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cc.bk
More file actions
57 lines (41 loc) · 1.15 KB
/
main.cc.bk
File metadata and controls
57 lines (41 loc) · 1.15 KB
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
#include <vector>
#include <string>
#include <iostream>
#include "Schema.h"
#include "Catalog.h"
using namespace std;
int main () {
string table = "region", attribute, type;
vector<string> attributes, types;
vector<unsigned int> distincts;
attribute = "r_regionkey"; attributes.push_back(attribute);
type = "INTEGER"; types.push_back(type);
distincts.push_back(5);
attribute = "r_name"; attributes.push_back(attribute);
type = "STRING"; types.push_back(type);
distincts.push_back(5);
attribute = "r_comment"; attributes.push_back(attribute);
type = "STRING"; types.push_back(type);
distincts.push_back(5);
Schema s(attributes, types, distincts);
Schema s1(s), s2; s2 = s1;
string a1 = "r_regionkey", b1 = "regionkey";
string a2 = "r_name", b2 = "name";
string a3 = "r_commen", b3 = "comment";
s1.RenameAtt(a1, b1);
s1.RenameAtt(a2, b2);
s1.RenameAtt(a3, b3);
s2.Append(s1);
vector<int> keep;
keep.push_back(5);
keep.push_back(0);
s2.Project(keep);
cout << s << endl;
cout << s1 << endl;
cout << s2 << endl;
string dbFile = "catalog.sqlite";
Catalog c(dbFile);
c.CreateTable(table, attributes, types);
cout << c << endl;
return 0;
}