diff --git a/Attribute.cpp b/Attribute.cpp index a87ee9e..0ef939e 100755 --- a/Attribute.cpp +++ b/Attribute.cpp @@ -7,6 +7,7 @@ Attribute::Attribute(){ type = ""; key = 0; size = 0; + limit = 0; } Attribute::Attribute(string n, string t, bool k){ @@ -14,13 +15,15 @@ Attribute::Attribute(string n, string t, bool k){ type = t; key = k; size = 0; + limit = 20; } Attribute::Attribute(string n, string t, bool k, int s){ name = n; type = t; key = k; - size = s; + size = 0; + limit = s; } void Attribute::addCell(string v){ diff --git a/Attribute.h b/Attribute.h index 19881ce..72b97d6 100755 --- a/Attribute.h +++ b/Attribute.h @@ -10,6 +10,7 @@ class Attribute{ string type; bool key; int size; + int limit; public: Attribute(); diff --git a/DBEngine.cpp b/DBEngine.cpp index cb43ca4..9bfc700 100755 --- a/DBEngine.cpp +++ b/DBEngine.cpp @@ -25,7 +25,7 @@ void DBEngine::createTable(Relation r){ size++; } -void DBEngine::insertValues(string r, vector v) +void DBEngine::insertValues(string r, vector v) { for(int i = 0; i < tables.size(); i++) { @@ -58,11 +58,12 @@ void DBEngine::save(string n){ string name = n + ".txt"; file.open(name); - for(int i = 0; i < commands.size(); ++i){ + for(int i = 0; i < commands.size(); ++i) + { file << commands[i] << endl; } - file.close(); + //file.close(); } vector DBEngine::getRelations(){ diff --git a/DBEngine.h b/DBEngine.h index 7d519b6..d23dffb 100755 --- a/DBEngine.h +++ b/DBEngine.h @@ -21,22 +21,13 @@ public: Relation& getTableFromName(string n); void saveToFile(vector cmds); Relation selection(string attName, string s, Relation r); - Relation projection(vector input, Relation r); -<<<<<<< HEAD - Relation product(string s1, Relation r1, Relation r2); - void rename(Relation& r, vector oldnames, vector newnames); + Relation projection(vector input, Relation r); + Relation product(string s1, Relation r1, Relation r2); void save(); void save(string n); - void storeCommands(string s); - Relation setUnion(Relation r1, Relation r2); - //void setDiff(); - //void crossProduct(); -======= - void save(); void storeCommands(string s); void rename(Relation& r, vector oldnames, vector newnames); Relation setUnion(Relation r1, Relation r2); Relation setDiff(Relation r1, Relation r2); - Relation crossProduct(Relation r1, Relation r2); ->>>>>>> master + Relation crossProduct(Relation r1, Relation r2); }; diff --git a/test b/test index e72e3b0..8eb7a6d 100755 Binary files a/test and b/test differ diff --git a/test.cpp b/test.cpp index 2c85d22..875361c 100755 --- a/test.cpp +++ b/test.cpp @@ -48,4 +48,12 @@ int main () { //engine.getTableFromName("MoarFood").display(); engine.crossProduct(engine.getTableFromName("Food"), engine.getTableFromName("MoarFood")).display(); + string x; + cout << "Enter DBMS Commands: "; + while(getline(cin, x)) + { + //cout << x << endl; + parse(x, engine); + cout << "Enter DBMS Commands: "; + } }