Projection is now working correctly, no segfault
This commit is contained in:
parent
8e308110b8
commit
94e2844ffa
1 changed files with 7 additions and 1 deletions
|
@ -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
|
||||
|
|
Reference in a new issue