Fixed merge issues. Everything compiles and runs again.

This commit is contained in:
Alexander Huddleston 2015-09-27 00:58:19 -05:00
parent b0aaaf902f
commit 3436a00452
6 changed files with 37 additions and 128 deletions

View file

@ -44,14 +44,7 @@ void DBEngine::save(){
vector<Relation> DBEngine::getRelations(){
return tables;
}
<<<<<<< HEAD
<<<<<<< HEAD
=======
=======
>>>>>>> master
>>>>>>> master
Relation& DBEngine::getTableFromName(string n){
for(int i = 0; i < tables.size(); i++){
if (tables[i].getTableName() == n){
@ -64,7 +57,7 @@ Relation DBEngine::selection(string attName, string s, Relation r){
equality(attName, s, r);
}
/*
Relation DBEngine::selection(string attName, string s, Relation r){
equality(attName, s, r);
}
@ -73,6 +66,7 @@ Relation DBEngine::selection(string attName, string s, Relation r){
Relation DBEngine::selection(string attName, string s, Relation r){
equality(attName, s, r);
}
*/
//assumes that all attribute titles are unique
Relation DBEngine::projection(vector<string> input, Relation r){
@ -89,9 +83,7 @@ Relation DBEngine::projection(vector<string> input, Relation r){
}
Relation temp(new_name, v);
return temp;
<<<<<<< HEAD
<<<<<<< HEAD
return temp;
}
Relation DBEngine::product(string new_name, Relation r1, Relation r2){
@ -113,11 +105,7 @@ Relation DBEngine::product(string new_name, Relation r1, Relation r2){
vector<string> tuple2;
vector<string> result_tuple;
return temp;
=======
>>>>>>> master
=======
>>>>>>> master
return temp;
}
//test error matching
@ -138,12 +126,10 @@ void DBEngine::rename(Relation& r, vector<string> oldnames, vector<string> newna
}
}
}
<<<<<<< HEAD
<<<<<<< HEAD
/*Relation DBEngine::setUnion(Relation r1, Relation r2){
/*
Relation DBEngine::setUnion(Relation r1, Relation r2){
if (r1.getAttributeNames() != r2.getAttributeNames()){
cout << "Failure to union: the relations are not union-compatible";
return;
@ -151,9 +137,7 @@ void DBEngine::rename(Relation& r, vector<string> oldnames, vector<string> newna
else {
vector<Attribute> r1_atts = r1.getAttributes();
=======
=======
>>>>>>> master
*/
Relation DBEngine::setUnion(Relation r1, Relation r2){
if (r1.getAttributeNames() != r2.getAttributeNames()){
cout << "Failure to union: the relations are not union-compatible.\nreturning the first relation.\n";
@ -187,13 +171,9 @@ Relation DBEngine::setUnion(Relation r1, Relation r2){
/*
/*vector<Attribute> r1_atts = r1.getAttributes();
<<<<<<< HEAD
>>>>>>> master
=======
>>>>>>> master
vector<Attribute> r1_atts = r1.getAttributes();
vector<Attribute> r2_atts = r2.getAttributes();
vector<Attribute> new_atts = r1_atts;
@ -213,19 +193,7 @@ Relation DBEngine::setUnion(Relation r1, Relation r2){
}
//currently all returned relations are called TEMP
Relation new_r("TEMP", new_atts);
<<<<<<< HEAD
<<<<<<< HEAD
return new_r;
}
}*/
=======
Relation new_r("TEMP", new_atts);
return new_r;*/
}
}
>>>>>>> master
=======
return new_r;*/
}
}
>>>>>>> master
}

View file

@ -22,18 +22,10 @@ public:
Relation selection(string attName, string s, Relation r);
Relation projection(vector<string> input, Relation r);
Relation product(string s1, Relation r1, Relation r2);
void rename(Relation& r, vector<string> oldnames, vector<string> newnames);
<<<<<<< HEAD
<<<<<<< HEAD
void rename(Relation& r, vector<string> oldnames, vector<string> newnames);
void save();
void storeCommands(string s);
//Relation setUnion(Relation r1, Relation r2);
=======
Relation setUnion(Relation r1, Relation r2);
>>>>>>> master
=======
Relation setUnion(Relation r1, Relation r2);
>>>>>>> master
void storeCommands(string s);
Relation setUnion(Relation r1, Relation r2);
//void setDiff();
//void crossProduct();
};

View file

@ -7,13 +7,6 @@
using namespace std;
<<<<<<< HEAD
=======
<<<<<<< HEAD
>>>>>>> master
=======
>>>>>>> master
class PRelation
{
string name;
@ -269,18 +262,6 @@ class PComparison
public:
PComparison()
<<<<<<< HEAD
<<<<<<< HEAD
{
op.setPOp("~");
operand1.setPOperand("~");
operand2.setPOperand("~");
}
PComparison(string str1, string str2, string str3)
=======
=======
>>>>>>> master
{
op.setPOp("~");
operand1.setPOperand("~");
@ -295,19 +276,6 @@ class PComparison
}
void setPComparison(string str1, string str2, string str3)
<<<<<<< HEAD
>>>>>>> master
=======
>>>>>>> master
{
operand1.setPOperand(str1);
op.setPOp(str2);
operand2.setPOperand(str3);
}
<<<<<<< HEAD
<<<<<<< HEAD
void setPComparison(string str1, string str2, string str3)
{
operand1.setPOperand(str1);
op.setPOp(str2);
@ -316,14 +284,6 @@ class PComparison
string getPComparison()
{
=======
string getPComparison()
{
>>>>>>> master
=======
string getPComparison()
{
>>>>>>> master
return operand1.getPOperand() + " " + op.getPOp() + " " + operand2.getPOperand();
}
};
@ -431,10 +391,8 @@ class PExpression
return temp;
}
};
<<<<<<< HEAD
<<<<<<< HEAD
/*
vector<string> tokenize(string ss)
{
@ -835,7 +793,7 @@ void par_line(vector<string> input) //calls par_command() or par_query() dependi
Match the first item in the token list and determine weather this is a command or a query.
Call functions par_command() or par_query();
After either par_command() or par_query() returns, make sure the line ends properly with ; token
*/
string tempChar = input.back();
if (tempChar != ";")
@ -921,8 +879,6 @@ void parse(string input, DBEngine &engine)
vector<string> listOfTokens = tokenize(input);
par_line(listOfTokens);
}
*/
=======
>>>>>>> master
=======
>>>>>>> master
void parse(string s, DBEngine &e);

View file

@ -486,6 +486,13 @@ void par_line(vector<string> input) //calls par_command() or par_query() dependi
}
}
void parse(string input, DBEngine &engine)
{
engine.storeCommands(input);
vector<string> listOfTokens = tokenize(input);
par_line(listOfTokens);
}
/*
int main () {
@ -503,3 +510,4 @@ int main () {
}
*/

View file

@ -1,14 +1,7 @@
#include <iostream>
#include <vector>
<<<<<<< HEAD
<<<<<<< HEAD
#include "Parserv3.h"
=======
#include "Condition.h"
>>>>>>> master
=======
#include "Condition.h"
>>>>>>> master
#include <vector>
#include "Parserv3.h"
//#include "Condition.h"
#include "DBEngine.h"
using namespace std;
@ -35,9 +28,7 @@ int main() {
v.push_back(att1);
v.push_back(att2);
v.push_back(att3);
<<<<<<< HEAD
<<<<<<< HEAD
Relation r("Food", v);
//r.renameAttribute("Breakfast", "BFST");
//r.display();
@ -101,13 +92,10 @@ int main () {
parse(ss3, engine);
engine.save();
=======
engine.createTable("Food", v);
=======
engine.createTable("Food", v);
>>>>>>> master
/*
//engine.createTable("Food", v);
//engine.createTable("Food", v);
Attribute att4("Breakfast", "VARCHAR(20)", true);
Attribute att5("Lunch", "VARCHAR(20)", false);
@ -131,8 +119,5 @@ int main () {
engine.createTable("MoarFood", v2);
engine.setUnion(engine.getTableFromName("Food"), engine.getTableFromName("MoarFood")).display();
<<<<<<< HEAD
>>>>>>> master
=======
>>>>>>> master
*/
}