diff --git a/Attribute.cpp b/Attribute.cpp index a2ae7f6..dad5d6a 100755 --- a/Attribute.cpp +++ b/Attribute.cpp @@ -52,6 +52,11 @@ void Attribute::setName(string s){ name = s; } +void Attribute::setValue(string s, int index) +{ + values[index] = s; +} + string Attribute::getType(){ return type; } diff --git a/Attribute.h b/Attribute.h index 72b97d6..46bd0b3 100755 --- a/Attribute.h +++ b/Attribute.h @@ -22,6 +22,7 @@ public: vector getValues(); string getName(); void setName(string s); + void setValue(string s, int index); string getType(); bool isKey(); int getSize(); diff --git a/DBAppV2.cpp b/DBAppV2.cpp index a66537a..3b96c2b 100644 --- a/DBAppV2.cpp +++ b/DBAppV2.cpp @@ -2,7 +2,7 @@ using namespace std; - +/* void yourAccount() { @@ -123,3 +123,4 @@ int main() else {cout<<"oops";} } +*/ \ No newline at end of file diff --git a/Parser.cpp b/Parser.cpp index 61272d7..d665816 100644 --- a/Parser.cpp +++ b/Parser.cpp @@ -1019,14 +1019,18 @@ vector insertCMD(vector input, DBEngine &engine) vector updateCMD(vector input, DBEngine &engine) { - PRelation r(input[0]); + Relation r = engine.getTableFromName(input[0]); + Relation rcond("TEMP"); + Relation rfinal("TEMP"); input.erase(input.begin()); if(input[0] == "SET") { input.erase(input.begin()); + vector a = r.getAttributes(); + //parse out ( and send everything until ) into an Expression vector if(input[0] == "(") { @@ -1043,8 +1047,6 @@ vector updateCMD(vector input, DBEngine &engine) while(input[0] != ")") { temp.setPAttributeName(input[0]); - a.push_back(temp); - temp.setPAttributeName("~"); input.erase(input.begin()); @@ -1053,6 +1055,15 @@ vector updateCMD(vector input, DBEngine &engine) input.erase(input.begin()); s.push_back(input[0]); + + if(input[0].at(0) == '\"') + { + s.push_back(input[0].substr(1, input[0].find_last_of("\""))); + } + else + { + s.push_back(input[0]); + } } else @@ -1064,15 +1075,20 @@ vector updateCMD(vector input, DBEngine &engine) { input.erase(input.begin()); } + + a.push_back(temp); + temp.setPAttributeName("~"); } + } if(input[0] == "WHERE") { + vector s; if(input[0] == "(") { //PCondition c; - + /* PComparison c; POperand oops1; POperand oops2; @@ -1091,7 +1107,16 @@ vector updateCMD(vector input, DBEngine &engine) c.setPComparison(oops1.getPOperand(), op.getPOp(), oops2.getPOperand()); } + */ + input.erase(input.begin()); + while(input[0] != ")") + { + s.push_back(input[0]); + input.erase(input.begin()); + } + rcond = condition(s, r, engine); } + } // send update command to DBEngine diff --git a/test b/test index e09c206..8833e9b 100755 Binary files a/test and b/test differ