cleanup
This commit is contained in:
parent
dd4453c9aa
commit
a3a354c5f0
5 changed files with 6 additions and 47 deletions
|
@ -24,36 +24,4 @@ Relation equality(string attName, string s, Relation r){
|
|||
//currently all returned relations are called TEMP
|
||||
Relation new_r("TEMP", new_atts);
|
||||
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) {
|
||||
//
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
|
@ -150,7 +150,6 @@ Relation DBEngine::projection(vector<string> input, Relation r){
|
|||
return temp;
|
||||
}
|
||||
|
||||
//test error matching
|
||||
Relation DBEngine::rename(vector<string> newnames, Relation &r){
|
||||
vector<string> temp;
|
||||
if (r.getSize() != newnames.size()) {
|
||||
|
@ -214,7 +213,6 @@ Relation DBEngine::setDiff(Relation r1, Relation r2){
|
|||
Relation new_r = r1;
|
||||
new_r.setTableName("TEMP");
|
||||
vector<string> temp;
|
||||
//bool duplicate = false;
|
||||
|
||||
int size = 0;
|
||||
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
#include <vector>
|
||||
#include "Relation.h"
|
||||
|
||||
//still in progress
|
||||
class DBEngine{
|
||||
vector<Relation> tables;
|
||||
vector<string> commands;
|
||||
|
|
15
Parser.cpp
15
Parser.cpp
|
@ -137,7 +137,6 @@ Relation condition(vector<string> input, Relation &r, DBEngine &engine){
|
|||
c = input[0].substr(1, input[0].find_last_of("\"") - 1);
|
||||
input.erase(input.begin());
|
||||
int offset = 0;
|
||||
//input.erase(input.begin());
|
||||
if(op == "=="){
|
||||
for(int i = 0; i < r.getAttributes().size(); ++i){
|
||||
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 == "!=")
|
||||
{
|
||||
for(int i = 0; i < r.getAttributes().size(); ++i)
|
||||
|
@ -635,7 +632,7 @@ vector<string> createCMD(vector<string> input, DBEngine &engine){
|
|||
|
||||
vector <PAttribute> a;
|
||||
|
||||
while(input[0] != ")") //inserting all values to relation
|
||||
while(input[0] != ")")
|
||||
{
|
||||
PAttribute temp;
|
||||
|
||||
|
@ -671,7 +668,7 @@ vector<string> createCMD(vector<string> input, DBEngine &engine){
|
|||
if(input[0] == "(")
|
||||
{
|
||||
|
||||
while(input[0] != ")") //inserting all values to relation
|
||||
while(input[0] != ")")
|
||||
{
|
||||
|
||||
if (input[0] == ",")
|
||||
|
@ -705,9 +702,9 @@ vector<string> createCMD(vector<string> input, DBEngine &engine){
|
|||
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){
|
||||
|
@ -868,8 +865,6 @@ vector<string> updateCMD(vector<string> input, DBEngine &engine){
|
|||
{
|
||||
input.erase(input.begin());
|
||||
|
||||
//s.push_back(input[0]);
|
||||
|
||||
if(input[0].at(0) == '\"')
|
||||
{
|
||||
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);
|
||||
}
|
||||
|
||||
else cout<<"Syntax error!"<<endl; //make specific
|
||||
else cout<<"Syntax error!"<<endl;
|
||||
|
||||
return input;
|
||||
}
|
||||
|
|
|
@ -75,7 +75,6 @@ bool Relation::isAttribute(string s) {
|
|||
}
|
||||
}
|
||||
return false;
|
||||
//cout << "Failure to return: the requested attribute does not exist.";
|
||||
}
|
||||
|
||||
void Relation::renameAttribute(string oldstr, string newstr){
|
||||
|
|
Reference in a new issue