diff --git a/Parserv3.h b/Parserv3.h index ff44cfd..50355ed 100644 --- a/Parserv3.h +++ b/Parserv3.h @@ -188,25 +188,35 @@ class PRenaming class PProjection { - string newName; - string oldName; + string AName; + string RName; public: PProjection() { - newName = "~"; - oldName = "~"; + AName = "~"; + RName = "~"; } PProjection(string s1, string s2) { - newName = s1; - oldName = s2; + AName = s1; + RName = s2; + } + + void setAName(string s) + { + AName = s; + } + + void setRName(string s) + { + RName = s; } string doPProjection() { - return "Projecting " + oldName + " onto " + newName; + return "Projecting " + AName + " onto " + RName; } }; @@ -388,11 +398,22 @@ class PExpression PExpression(string str) { temp = str; + /* + if(str == "project") + { + proj.setAName(""); + proj.setRName(""); + }*/ } void setPExpression(string str) { temp = str; + /* + if(proj.getAName() != "~" && proj.getRName() != "~") + { + proj.setAName() + }*/ } string getPExpression() diff --git a/Parserv4.cpp b/Parserv4.cpp index 09a7383..b947cc2 100644 --- a/Parserv4.cpp +++ b/Parserv4.cpp @@ -184,7 +184,9 @@ vector createCMD(vector input) input.erase(input.begin()); } - + + // send create commands to DBEngine + return input; } } @@ -251,15 +253,30 @@ vector insertCMD(vector input) { input.erase(input.begin()); - PExpression e; + //PExpression e(input[0]); - while(input[0] != ";") + //input.erase(input.begin()); + + if(input[0] == "project") { - e.setPExpression(e.getPExpression() + input[0]); + PProjection p; + + input.erase(input.begin()); + + if(intput[0].at(0) == "(") + { + p.setAName(input[0].substr(1, input[0].find(")"))); + } + + input.erase(input.begin()); + + p.setRName(input[0]); + + input.erase(input.begin()); + + // send projection command to DBengine. } - cout << "Inserting: " << e.getPExpression() << " into " << r.getName() << ".\n"; - return input; }