Added case for insert to do projected, to add more cases later.

This commit is contained in:
Alexander Huddleston 2015-09-24 13:55:45 -05:00
parent e2718e3c91
commit 1448b0147d
2 changed files with 51 additions and 13 deletions

View file

@ -188,25 +188,35 @@ class PRenaming
class PProjection class PProjection
{ {
string newName; string AName;
string oldName; string RName;
public: public:
PProjection() PProjection()
{ {
newName = "~"; AName = "~";
oldName = "~"; RName = "~";
} }
PProjection(string s1, string s2) PProjection(string s1, string s2)
{ {
newName = s1; AName = s1;
oldName = s2; RName = s2;
}
void setAName(string s)
{
AName = s;
}
void setRName(string s)
{
RName = s;
} }
string doPProjection() string doPProjection()
{ {
return "Projecting " + oldName + " onto " + newName; return "Projecting " + AName + " onto " + RName;
} }
}; };
@ -388,11 +398,22 @@ class PExpression
PExpression(string str) PExpression(string str)
{ {
temp = str; temp = str;
/*
if(str == "project")
{
proj.setAName("");
proj.setRName("");
}*/
} }
void setPExpression(string str) void setPExpression(string str)
{ {
temp = str; temp = str;
/*
if(proj.getAName() != "~" && proj.getRName() != "~")
{
proj.setAName()
}*/
} }
string getPExpression() string getPExpression()

View file

@ -185,6 +185,8 @@ vector<string> createCMD(vector<string> input)
input.erase(input.begin()); input.erase(input.begin());
} }
// send create commands to DBEngine
return input; return input;
} }
} }
@ -251,14 +253,29 @@ vector<string> insertCMD(vector<string> input)
{ {
input.erase(input.begin()); 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(")")));
} }
cout << "Inserting: " << e.getPExpression() << " into " << r.getName() << ".\n"; input.erase(input.begin());
p.setRName(input[0]);
input.erase(input.begin());
// send projection command to DBengine.
}
return input; return input;
} }