Merge branch 'beccadev'

This commit is contained in:
Rebecca Schofield 2015-10-06 23:37:14 -05:00
commit 048d7de669
5 changed files with 6 additions and 47 deletions

View file

@ -24,36 +24,4 @@ Relation equality(string attName, string s, Relation r){
//currently all returned relations are called TEMP //currently all returned relations are called TEMP
Relation new_r("TEMP", new_atts); Relation new_r("TEMP", new_atts);
return new_r; return new_r;
} }
/*
vector<Attribute> equality(Attribute a, int i){
for (int i = 0; i < a.getSize(); ++i) {
//
}
}
vector<Attribute> gt(Attribute a, int i){
for (int i = 0; i < a.getSize(); ++i) {
//
}
}
vector<Attribute> lt(Attribute a, int i){
for (int i = 0; i < a.getSize(); ++i) {
//
}
}
vector<Attribute> gte(Attribute a, int i){
for (int i = 0; i < a.getSize(); ++i) {
//
}
}
vector<Attribute> lte(Attribute a, int i){
for (int i = 0; i < a.getSize(); ++i) {
//
}
}
*/

View file

@ -150,7 +150,6 @@ Relation DBEngine::projection(vector<string> input, Relation r){
return temp; return temp;
} }
//test error matching
Relation DBEngine::rename(vector<string> newnames, Relation &r){ Relation DBEngine::rename(vector<string> newnames, Relation &r){
vector<string> temp; vector<string> temp;
if (r.getSize() != newnames.size()) { if (r.getSize() != newnames.size()) {
@ -214,7 +213,6 @@ Relation DBEngine::setDiff(Relation r1, Relation r2){
Relation new_r = r1; Relation new_r = r1;
new_r.setTableName("TEMP"); new_r.setTableName("TEMP");
vector<string> temp; vector<string> temp;
//bool duplicate = false;
int size = 0; int size = 0;

View file

@ -4,7 +4,6 @@
#include <vector> #include <vector>
#include "Relation.h" #include "Relation.h"
//still in progress
class DBEngine{ class DBEngine{
vector<Relation> tables; vector<Relation> tables;
vector<string> commands; vector<string> commands;

View file

@ -137,7 +137,6 @@ Relation condition(vector<string> input, Relation &r, DBEngine &engine){
c = input[0].substr(1, input[0].find_last_of("\"") - 1); c = input[0].substr(1, input[0].find_last_of("\"") - 1);
input.erase(input.begin()); input.erase(input.begin());
int offset = 0; int offset = 0;
//input.erase(input.begin());
if(op == "=="){ if(op == "=="){
for(int i = 0; i < r.getAttributes().size(); ++i){ for(int i = 0; i < r.getAttributes().size(); ++i){
if(r.getAttributes()[i].getName() == a1.getName()){ if(r.getAttributes()[i].getName() == a1.getName()){
@ -151,8 +150,6 @@ Relation condition(vector<string> input, Relation &r, DBEngine &engine){
} }
} }
//continue stylistic homogenization here
else if(op == "!=") else if(op == "!=")
{ {
for(int i = 0; i < r.getAttributes().size(); ++i) for(int i = 0; i < r.getAttributes().size(); ++i)
@ -635,7 +632,7 @@ vector<string> createCMD(vector<string> input, DBEngine &engine){
vector <PAttribute> a; vector <PAttribute> a;
while(input[0] != ")") //inserting all values to relation while(input[0] != ")")
{ {
PAttribute temp; PAttribute temp;
@ -671,7 +668,7 @@ vector<string> createCMD(vector<string> input, DBEngine &engine){
if(input[0] == "(") if(input[0] == "(")
{ {
while(input[0] != ")") //inserting all values to relation while(input[0] != ")")
{ {
if (input[0] == ",") if (input[0] == ",")
@ -705,9 +702,9 @@ vector<string> createCMD(vector<string> input, DBEngine &engine){
return input; return input;
} }
else cout<<"Syntax error! 2"<<endl; //refine else cout<<"Syntax error! 2"<<endl;
} }
else cout<<"Syntax error! 1"<<endl; //refine else cout<<"Syntax error! 1"<<endl;
} }
vector<string> insertCMD(vector<string> input, DBEngine &engine){ vector<string> insertCMD(vector<string> input, DBEngine &engine){
@ -868,8 +865,6 @@ vector<string> updateCMD(vector<string> input, DBEngine &engine){
{ {
input.erase(input.begin()); input.erase(input.begin());
//s.push_back(input[0]);
if(input[0].at(0) == '\"') if(input[0].at(0) == '\"')
{ {
c.push_back(input[0].substr(1, input[0].find_last_of("\"") - 1)); c.push_back(input[0].substr(1, input[0].find_last_of("\"") - 1));
@ -950,7 +945,7 @@ vector<string> deleteCMD(vector<string> input, DBEngine &engine)
engine.deleteFromRelationCmd(r, temp); engine.deleteFromRelationCmd(r, temp);
} }
else cout<<"Syntax error!"<<endl; //make specific else cout<<"Syntax error!"<<endl;
return input; return input;
} }

View file

@ -75,7 +75,6 @@ bool Relation::isAttribute(string s) {
} }
} }
return false; return false;
//cout << "Failure to return: the requested attribute does not exist.";
} }
void Relation::renameAttribute(string oldstr, string newstr){ void Relation::renameAttribute(string oldstr, string newstr){