fixed rename
This commit is contained in:
parent
75be5ae221
commit
41ee4c99d2
3 changed files with 15 additions and 5 deletions
13
Condition.h
Executable file
13
Condition.h
Executable file
|
@ -0,0 +1,13 @@
|
|||
#include <iostream>
|
||||
#include "Attribute.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
class Condition{
|
||||
Attribute att;
|
||||
|
||||
public:
|
||||
//currently only implemented for comparison
|
||||
Condition(Attribute a);
|
||||
Condition(Attribute a);
|
||||
};
|
|
@ -29,7 +29,6 @@ vector<Relation> DBEngine::getRelations(){
|
|||
}
|
||||
|
||||
Relation& DBEngine::getTableFromName(string n){
|
||||
//will return first occurence
|
||||
for(int i = 0; i < tables.size(); i++){
|
||||
if (tables[i].getTableName() == n){
|
||||
return tables[i];
|
||||
|
@ -37,8 +36,8 @@ Relation& DBEngine::getTableFromName(string n){
|
|||
}
|
||||
}
|
||||
|
||||
//currently writes nothing meaningful
|
||||
void DBEngine::saveToFile(vector<string> cmds){
|
||||
//writes nothing meaningful
|
||||
ofstream file;
|
||||
file.open("savefile.db");
|
||||
|
||||
|
@ -60,7 +59,7 @@ Relation DBEngine::projection(vector<string> input, Relation r){
|
|||
// }
|
||||
}
|
||||
|
||||
//ASAP: TEST ALL OF THIS
|
||||
//TEST ERRORS MATCHING
|
||||
void DBEngine::rename(Relation& r, vector<string> oldnames, vector<string> newnames){
|
||||
if (oldnames.size() != newnames.size()) {
|
||||
cout << "Failure to rename: number of attributes do not match.";
|
||||
|
|
|
@ -17,8 +17,6 @@ public:
|
|||
//void showTable(Relation r);
|
||||
Relation& getTableFromName(string n);
|
||||
void saveToFile(vector<string> cmds);
|
||||
|
||||
//operations
|
||||
//Relation selection();
|
||||
Relation projection(vector<string> input, Relation r);
|
||||
void rename(Relation& r, vector<string> oldnames, vector<string> newnames);
|
||||
|
|
Reference in a new issue