Merge branch 'beccadev'
This commit is contained in:
commit
c81c80193f
3 changed files with 36 additions and 12 deletions
27
DBEngine.h
27
DBEngine.h
|
@ -22,22 +22,31 @@ public:
|
||||||
tables.push_back(r);
|
tables.push_back(r);
|
||||||
}
|
}
|
||||||
|
|
||||||
void showTables(String name) {
|
Relation getTableFromName(string n) {
|
||||||
|
//will return first occurence
|
||||||
for(int i = 0; i < tables.size(); i++) {
|
for(int i = 0; i < tables.size(); i++) {
|
||||||
if (tables.getTableName() == name) {
|
if (tables[i].getTableName() == n) {
|
||||||
name.display();
|
return tables[i];
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void showTables(Relation r) {
|
||||||
|
r.display();
|
||||||
|
}
|
||||||
|
|
||||||
void saveToFile() { /*Becca*/ }
|
void saveToFile() { /*Becca*/ }
|
||||||
void insertTuple() { /*William*/ }
|
void insertTuple() { /*DONE*/ }
|
||||||
void deleteTuple() { /*William*/ }
|
void deleteTuple() { /*DONE*/ }
|
||||||
void selectTuples() { /*Becca*/ }
|
void selectTuples() { /*William*/ }
|
||||||
void project() { /*Brandon*/ }
|
void project() { /*DONE*/ }
|
||||||
void product() { /*Brandon*/ }
|
void product() { /*Brandon*/ }
|
||||||
void unionComp() { /*William*/ }
|
|
||||||
|
bool unionComp(Relation r1, Relation r2) {
|
||||||
|
//Two relations are union-compatible if they have the same # of attributes and each attribute must be
|
||||||
|
//from the same domain
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
vector<Relation> getRelations() {
|
vector<Relation> getRelations() {
|
||||||
|
|
BIN
a.out
BIN
a.out
Binary file not shown.
21
test.cpp
21
test.cpp
|
@ -13,21 +13,36 @@ int main() {
|
||||||
att1.addRow("sponge");
|
att1.addRow("sponge");
|
||||||
att1.addRow("wooow");
|
att1.addRow("wooow");
|
||||||
att1.addRow("cloth");
|
att1.addRow("cloth");
|
||||||
att1.display();
|
|
||||||
|
|
||||||
Attribute att2("doom", "VARCHAR(20)", false);
|
Attribute att2("doom", "VARCHAR(20)", false);
|
||||||
att2.addRow("zombieman");
|
att2.addRow("zombieman");
|
||||||
att2.addRow("revenant");
|
att2.addRow("revenant");
|
||||||
att2.addRow("imp");
|
att2.addRow("imp");
|
||||||
att2.addRow("archvile");
|
att2.addRow("archvile");
|
||||||
att2.display();
|
|
||||||
|
|
||||||
vector<Attribute> vec;
|
vector<Attribute> vec;
|
||||||
vec.push_back(att1);
|
vec.push_back(att1);
|
||||||
vec.push_back(att2);
|
vec.push_back(att2);
|
||||||
|
|
||||||
|
Attribute att3("name", "VARCHAR(20)", true);
|
||||||
|
att1.addRow("Fry");
|
||||||
|
att1.addRow("Bender");
|
||||||
|
att1.addRow("Leela");
|
||||||
|
att1.addRow("Zoidberg");
|
||||||
|
|
||||||
|
Attribute att4("age", "INTEGER", false);
|
||||||
|
att2.addRow("22");
|
||||||
|
att2.addRow("5");
|
||||||
|
att2.addRow("22");
|
||||||
|
att2.addRow("50");
|
||||||
|
|
||||||
|
vector<Attribute> vec2;
|
||||||
|
vec2.push_back(att3);
|
||||||
|
vec2.push_back(att4);
|
||||||
|
|
||||||
//beginning testing of core DB functions
|
//beginning testing of core DB functions
|
||||||
engine.createTable("table1", vec);
|
engine.createTable("table1", vec);
|
||||||
engine.showTables("table1");
|
engine.createTable("table2", vec2);
|
||||||
|
engine.showTables(engine.getTableFromName("table1"));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Reference in a new issue