diff --git a/Attribute.h b/Attribute.h index fb3fd48..50949a1 100755 --- a/Attribute.h +++ b/Attribute.h @@ -46,10 +46,5 @@ public: { cout< cmds) { ofstream file; - file.open("savefile.txt"); + file.open("savefile.db"); for(int i = 0; i < cmds.size(); ++i){ file << cmds[i] << endl; @@ -42,10 +42,19 @@ public: file.close(); } - void insertTuple() { /*DONE*/ } - void deleteTuple() { /*DONE*/ } - void selectTuples() { /*DONE*/ } + void insertTuple(Relation r, vector t) { r.addTuple(t); } + + //need to add find by name + void deleteTuple(Relation r, int n) { + cout << "a"; + r.removeTuple(n); } + + void selectTuples() { + // + } + void project(Relation r, string n) { r.projectQuery(n); } + void product() { /*Brandon*/ } bool unionComp(Relation r1, Relation r2) { diff --git a/Relation.h b/Relation.h index f8e7a49..85a9f15 100755 --- a/Relation.h +++ b/Relation.h @@ -31,7 +31,7 @@ public: } } - void removeTuple(int tupleNum) { + void removeTuple(int tupleNum) { if (tupleNum > att[0].getSize() || tupleNum < 0) { cout<<"ERROR! index out of bound"< cmds; cmds.push_back("CREATE TABLE animals (name VARCHAR(20), kind VARCHAR(8), years INTEGER) PRIMARY KEY (name, kind);"); cmds.push_back("SHOW animals;"); engine.saveToFile(cmds); + + vector t; + t.push_back("Professor"); + t.push_back("180"); + + //engine.insertTuple((engine.getTableFromName("table1")), t); + engine.deleteTuple((engine.getTableFromName("table1")), 2); + + cout << "\n\n"; + engine.showTable((engine.getTableFromName("table1"))); }