diff --git a/DBApp.cpp b/DBApp.cpp index 82f49d6..eacadaa 100755 --- a/DBApp.cpp +++ b/DBApp.cpp @@ -3,12 +3,38 @@ #include // std::stringstream #include #include -//#include "Parserv3.h" -//#include "DBEngine.h" +#include "Parserv3.h" +#include "DBEngine.h" using namespace std; - +/* int main() { - cout << "Testing." << endl; + cout << "**********************" << endl; + cout << "* Generic Restaurant *" << endl; + cout << "**********************" << endl; + cout << "- Login -" << endl; + cout << "1. Login" << endl; + cout << "2. Request new account" << endl; + cout << "Enter coice: "; + int n; + cin >> n; + string u; + string p; + switch(n) + { + case 1: cout << "- Login -" << endl; + cout << "Enter username: "; + cin >> u; + cout << "Enter password: "; + cin >> p; + // implement user database. + break; + case 2: cout << "Not implemented." << endl; + break; // not implemented. + default: cout << "Not an option." << endl; + return 0; + } + } +*/ \ No newline at end of file diff --git a/Relation.cpp b/Relation.cpp index 86a6dad..0e3f95a 100755 --- a/Relation.cpp +++ b/Relation.cpp @@ -69,7 +69,7 @@ int Relation::getSize(){ void Relation::display(){ cout << "--------------------------\n"; - cout << name << "\n"; + cout << getTableName() << "\n"; for (int i = 0; i < att.size(); ++i){ att[i].display(); } diff --git a/test b/test index 28ebf9c..a3e72f0 100755 Binary files a/test and b/test differ diff --git a/test.cpp b/test.cpp index 8a5c3f8..25c217c 100755 --- a/test.cpp +++ b/test.cpp @@ -93,9 +93,26 @@ int main () { engine.save(); - - //engine.createTable("Food", v); - //engine.createTable("Food", v); + 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 v; + v.push_back(att1); + v.push_back(att2); + v.push_back(att3); + + engine.createTable("Food", v); Attribute att4("Breakfast", "VARCHAR(20)", true); Attribute att5("Lunch", "VARCHAR(20)", false); @@ -118,8 +135,8 @@ int main () { engine.createTable("MoarFood", v2); - //engine.getTableFromName("Food").display(); + engine.getTableFromName("MoarFood").display(); - // engine.setUnion(engine.getTableFromName("Food"), engine.getTableFromName("MoarFood")).display(); + engine.setUnion(engine.getTableFromName("Food"), engine.getTableFromName("MoarFood")).display(); }