Re-Updated projection... again.
This commit is contained in:
parent
6f10af0b32
commit
71961f6659
1 changed files with 12 additions and 5 deletions
15
DBEngine.cpp
15
DBEngine.cpp
|
@ -51,12 +51,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++) {
|
||||
// it = find(r.getAttributes().begin(), r.getAttributes().end(), input[i])
|
||||
for(int i = 0; i < input.size(); ++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
|
||||
|
|
Reference in a new issue