Projection is now working correctly, no segfault

This commit is contained in:
Brandon Jackson 2015-09-22 00:03:53 -05:00
parent 8e308110b8
commit 94e2844ffa

View file

@ -52,13 +52,19 @@ void DBEngine::saveToFile(vector<string> cmds){
//assumes that all attribute titles are unique
Relation DBEngine::projection(vector<string> input, Relation r){
vector<Attribute> v;
string new_name = r.getTableName() + " Projection";
for(int i = 0; i < input.size(); ++i) {
for(int j = 0; j < r.getSize(); ++j) {
if((r.getAttributes())[j].getName() == input[i])
(r.getAttributes())[j].display();
v.push_back((r.getAttributes())[j]);
}
}
Relation temp(new_name, v);
return temp;
}
//ASAP: TEST ALL OF THIS