to turn in

This commit is contained in:
Rebecca Schofield 2015-09-15 23:44:58 -05:00
parent 5a43be3b80
commit e2776d2459
4 changed files with 20 additions and 13 deletions

View file

@ -42,12 +42,12 @@ public:
file.close();
}
void insertTuple(Relation r, vector<string> t) { r.addTuple(t); }
//void insertTuple(Relation r, vector<string> t) { r.addTuple(t); }
//need to add find by name
void deleteTuple(Relation r, int n) {
/*void deleteTuple(Relation r, int n) {
cout << "a";
r.removeTuple(n); }
r.removeTuple(n); }*/
void selectTuples() {
//

View file

@ -17,7 +17,7 @@ public:
int getSize() { return size; }
void addTuple(vector<string> tuple) {
/*void addTuple(vector<string> tuple) {
//Loop through the attribute columns
for(int i = 0; i < att.size(); i++) {
@ -66,7 +66,7 @@ public:
}
}
return tupleSlot;
}
}*/
string getTableName() {
return name;

BIN
a.out Executable file

Binary file not shown.

View file

@ -8,7 +8,7 @@ using namespace std;
int main() {
DBEngine engine;
Attribute att1("shamWow", "VARCHAR(10)", true);
/*Attribute att1("shamWow", "VARCHAR(10)", true);
att1.addRow("rag");
att1.addRow("sponge");
att1.addRow("wooow");
@ -22,7 +22,7 @@ int main() {
vector<Attribute> vec;
vec.push_back(att1);
vec.push_back(att2);
vec.push_back(att2);*/
Attribute att3("name", "VARCHAR(20)", true);
att3.addRow("Fry");
@ -41,17 +41,24 @@ int main() {
vec2.push_back(att4);
//beginning testing of core DB functions
cout << "\a";
engine.createTable("table1", vec2);
engine.createTable("table2", vec);
cout << "\a";
//engine.createTable("table2", vec);
engine.showTable(engine.getTableFromName("table1"));
cout << "\n\n";
Attribute att5("name", "VARCHAR(20)", true);
cout << "\a";
/*Attribute att5("name", "VARCHAR(20)", true);
att5.addRow("Yrf");
att5.addRow("Redneb");
att5.addRow("Aleel");
att5.addRow("Grebdoiz");
cout << "\a";
Attribute att6("age", "INTEGER", false);
att6.addRow("44");
att6.addRow("10");
@ -62,7 +69,7 @@ int main() {
vec3.push_back(att5);
vec3.push_back(att6);
engine.createTable("table3", vec3);
engine.createTable("table3", vec3);*/
//cout << "\n";
//cout << engine.unionComp(engine.getTableFromName("table1"), engine.getTableFromName("table2"));
@ -71,18 +78,18 @@ int main() {
//engine.project((engine.getTableFromName("table1")), "name");
vector<string> cmds;
/*vector<string> 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);
engine.saveToFile(cmds);*/
vector<string> t;
t.push_back("Professor");
t.push_back("180");
//engine.insertTuple((engine.getTableFromName("table1")), t);
engine.deleteTuple((engine.getTableFromName("table1")), 2);
//engine.deleteTuple((engine.getTableFromName("table1")), 2);
cout << "\n\n";
engine.showTable((engine.getTableFromName("table1")));