Re-Updated projection... again.

This commit is contained in:
Brandon Jackson 2015-09-23 16:08:19 -05:00
parent 6f10af0b32
commit 71961f6659

View file

@ -51,12 +51,19 @@ void DBEngine::saveToFile(vector<string> cmds){
//assumes that all attribute titles are unique //assumes that all attribute titles are unique
Relation DBEngine::projection(vector<string> input, Relation r){ 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 i = 0; i < input.size(); ++i) {
// it = find(r.getAttributes().begin(), r.getAttributes().end(), input[i])
//if(r[i].getName == input[]) for(int j = 0; j < r.getSize(); ++j) {
// } if((r.getAttributes())[j].getName() == input[i])
v.push_back((r.getAttributes())[j]);
}
}
Relation temp(new_name, v);
return temp;
} }
//test error matching //test error matching
@ -76,4 +83,4 @@ void DBEngine::rename(Relation& r, vector<string> oldnames, vector<string> newna
r.renameAttribute(oldnames[i], newnames[i]); r.renameAttribute(oldnames[i], newnames[i]);
} }
} }
} }