Commented out DBApp.cpp as it's being developed. test.cpp all tests compile and run into test file.

This commit is contained in:
Alexander Huddleston 2015-09-27 16:48:08 -05:00
parent bcb9b0de81
commit e244c6ca45
4 changed files with 53 additions and 10 deletions

View file

@ -3,12 +3,38 @@
#include <sstream> // std::stringstream #include <sstream> // std::stringstream
#include <vector> #include <vector>
#include <string> #include <string>
//#include "Parserv3.h" #include "Parserv3.h"
//#include "DBEngine.h" #include "DBEngine.h"
using namespace std; using namespace std;
/*
int main() 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;
}
} }
*/

View file

@ -69,7 +69,7 @@ int Relation::getSize(){
void Relation::display(){ void Relation::display(){
cout << "--------------------------\n"; cout << "--------------------------\n";
cout << name << "\n"; cout << getTableName() << "\n";
for (int i = 0; i < att.size(); ++i){ for (int i = 0; i < att.size(); ++i){
att[i].display(); att[i].display();
} }

BIN
test

Binary file not shown.

View file

@ -93,9 +93,26 @@ int main () {
engine.save(); engine.save();
Attribute att1("Breakfast", "VARCHAR(20)", true);
//engine.createTable("Food", v); Attribute att2("Lunch", "VARCHAR(20)", false);
//engine.createTable("Food", v); 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);
engine.createTable("Food", v);
Attribute att4("Breakfast", "VARCHAR(20)", true); Attribute att4("Breakfast", "VARCHAR(20)", true);
Attribute att5("Lunch", "VARCHAR(20)", false); Attribute att5("Lunch", "VARCHAR(20)", false);
@ -118,8 +135,8 @@ int main () {
engine.createTable("MoarFood", v2); 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();
} }