diff --git a/DBEngine.h b/DBEngine.h index 4452ec2..f701b20 100755 --- a/DBEngine.h +++ b/DBEngine.h @@ -22,22 +22,31 @@ public: tables.push_back(r); } - void showTables(String name) { + Relation getTableFromName(string n) { + //will return first occurence for(int i = 0; i < tables.size(); i++) { - if (tables.getTableName() == name) { - name.display(); - break; + if (tables[i].getTableName() == n) { + return tables[i]; } } } + void showTables(Relation r) { + r.display(); + } + void saveToFile() { /*Becca*/ } - void insertTuple() { /*William*/ } - void deleteTuple() { /*William*/ } - void selectTuples() { /*Becca*/ } - void project() { /*Brandon*/ } + void insertTuple() { /*DONE*/ } + void deleteTuple() { /*DONE*/ } + void selectTuples() { /*William*/ } + void project() { /*DONE*/ } 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 getRelations() { diff --git a/a.out b/a.out index 3b18417..b0c907a 100755 Binary files a/a.out and b/a.out differ diff --git a/test.cpp b/test.cpp index 017d8e9..884021d 100755 --- a/test.cpp +++ b/test.cpp @@ -13,21 +13,36 @@ int main() { att1.addRow("sponge"); att1.addRow("wooow"); att1.addRow("cloth"); - att1.display(); Attribute att2("doom", "VARCHAR(20)", false); att2.addRow("zombieman"); att2.addRow("revenant"); att2.addRow("imp"); att2.addRow("archvile"); - att2.display(); vector vec; vec.push_back(att1); 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 vec2; + vec2.push_back(att3); + vec2.push_back(att4); //beginning testing of core DB functions engine.createTable("table1", vec); - engine.showTables("table1"); + engine.createTable("table2", vec2); + engine.showTables(engine.getTableFromName("table1")); }