71 lines
1.6 KiB
C++
Executable file
71 lines
1.6 KiB
C++
Executable file
#include <iostream>
|
|
#include <vector>
|
|
#include "DBEngine.h"
|
|
|
|
using namespace std;
|
|
|
|
//still in progress
|
|
int main() {
|
|
DBEngine engine;
|
|
Attribute att1("Breakfast", "VARCHAR(20)", true);
|
|
Attribute att2("Lunch", "VARCHAR(20)", false);
|
|
Attribute att3("Dinner", "VARCHAR(20)", false);
|
|
|
|
att1.addCell("Pancakes");
|
|
att1.addCell("Waffles");
|
|
att1.addCell("Biscuits");
|
|
att2.addCell("Turkey Sandwich");
|
|
att2.addCell("Caesar Salad");
|
|
att2.addCell("Pizza");
|
|
att3.addCell("Steak");
|
|
att3.addCell("Shrimp");
|
|
att3.addCell("Ribs");
|
|
|
|
vector<Attribute> v;
|
|
v.push_back(att1);
|
|
v.push_back(att2);
|
|
v.push_back(att3);
|
|
|
|
//Relation r("Food", v);
|
|
//r.renameAttribute("Breakfast", "BFST");
|
|
//r.display();
|
|
|
|
engine.createTable("Food", v);
|
|
|
|
vector<string> tuple;
|
|
tuple.push_back("Omelette");
|
|
tuple.push_back("Fried Rice");
|
|
tuple.push_back("Grouper");
|
|
|
|
engine.getTableFromName("Food").insertTuple(tuple);
|
|
|
|
vector<string> old;
|
|
vector<string> newa;
|
|
|
|
old.push_back("Breakfast");
|
|
old.push_back("Lunch");
|
|
old.push_back("Dinner");
|
|
|
|
newa.push_back("Tsafkaerb");
|
|
newa.push_back("Hcnul");
|
|
newa.push_back("Rennid");
|
|
|
|
<<<<<<< HEAD
|
|
//Projection test
|
|
vector<string> projectTest;
|
|
projectTest.push_back("Breakfast");
|
|
projectTest.push_back("Dinner");
|
|
|
|
cout << "\n***Initiated Projection***\n" << endl;
|
|
|
|
Relation sub_r = engine.projection(projectTest, r);
|
|
sub_r.display();
|
|
|
|
//engine.rename(r, o, n);
|
|
}
|
|
=======
|
|
engine.rename(engine.getTableFromName("Food"), old, newa);
|
|
engine.getTableFromName("Food").display();
|
|
cout << "finished";
|
|
}
|
|
>>>>>>> master
|