Merge branch 'master' into brandondev
Conflicts: DBEngine.cpp DBEngine.h Parserv3.h test.cpp
This commit is contained in:
commit
b0aaaf902f
8 changed files with 619 additions and 0 deletions
59
Condition.cpp
Executable file
59
Condition.cpp
Executable file
|
@ -0,0 +1,59 @@
|
|||
#include <iostream>
|
||||
#include "Attribute.h"
|
||||
#include "Relation.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
Relation equality(string attName, string s, Relation r){
|
||||
Attribute att = r.getAttributeByName(attName);
|
||||
vector<Attribute> r_atts = r.getAttributes();
|
||||
vector<Attribute> new_atts = r_atts;
|
||||
|
||||
for (int i = 0; i < new_atts.size(); ++i) {
|
||||
new_atts[i].clearAllValues();
|
||||
}
|
||||
|
||||
for (int i = 0; i < att.getSize(); ++i) {
|
||||
if (att[i] == s){
|
||||
for (int j = 0; j < r_atts.size(); ++j){
|
||||
new_atts[j].addCell(r_atts[j][i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//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) {
|
||||
//
|
||||
}
|
||||
}
|
||||
*/
|
23
DBEngine.cpp
23
DBEngine.cpp
|
@ -45,8 +45,11 @@ vector<Relation> DBEngine::getRelations(){
|
|||
return tables;
|
||||
}
|
||||
|
||||
<<<<<<< HEAD
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
=======
|
||||
>>>>>>> master
|
||||
|
||||
>>>>>>> master
|
||||
Relation& DBEngine::getTableFromName(string n){
|
||||
|
@ -62,6 +65,11 @@ Relation DBEngine::selection(string attName, string s, Relation r){
|
|||
}
|
||||
|
||||
|
||||
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);
|
||||
}
|
||||
|
@ -83,6 +91,7 @@ Relation DBEngine::projection(vector<string> input, Relation r){
|
|||
Relation temp(new_name, v);
|
||||
return temp;
|
||||
<<<<<<< HEAD
|
||||
<<<<<<< HEAD
|
||||
}
|
||||
|
||||
Relation DBEngine::product(string new_name, Relation r1, Relation r2){
|
||||
|
@ -107,6 +116,8 @@ Relation DBEngine::product(string new_name, Relation r1, Relation r2){
|
|||
return temp;
|
||||
=======
|
||||
>>>>>>> master
|
||||
=======
|
||||
>>>>>>> master
|
||||
}
|
||||
|
||||
//test error matching
|
||||
|
@ -129,6 +140,7 @@ void DBEngine::rename(Relation& r, vector<string> oldnames, vector<string> newna
|
|||
}
|
||||
|
||||
<<<<<<< HEAD
|
||||
<<<<<<< HEAD
|
||||
|
||||
|
||||
/*Relation DBEngine::setUnion(Relation r1, Relation r2){
|
||||
|
@ -140,6 +152,8 @@ 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";
|
||||
|
@ -176,6 +190,9 @@ Relation DBEngine::setUnion(Relation r1, Relation r2){
|
|||
|
||||
|
||||
/*vector<Attribute> r1_atts = r1.getAttributes();
|
||||
<<<<<<< HEAD
|
||||
>>>>>>> master
|
||||
=======
|
||||
>>>>>>> master
|
||||
vector<Attribute> r2_atts = r2.getAttributes();
|
||||
vector<Attribute> new_atts = r1_atts;
|
||||
|
@ -197,6 +214,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;
|
||||
}
|
||||
|
@ -206,3 +224,8 @@ Relation DBEngine::setUnion(Relation r1, Relation r2){
|
|||
}
|
||||
}
|
||||
>>>>>>> master
|
||||
=======
|
||||
return new_r;*/
|
||||
}
|
||||
}
|
||||
>>>>>>> master
|
||||
|
|
|
@ -23,10 +23,14 @@ public:
|
|||
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 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
|
||||
|
|
BIN
DevelopmentLog.pdf
Executable file
BIN
DevelopmentLog.pdf
Executable file
Binary file not shown.
17
Parserv3.h
17
Parserv3.h
|
@ -10,6 +10,9 @@ using namespace std;
|
|||
<<<<<<< HEAD
|
||||
=======
|
||||
|
||||
<<<<<<< HEAD
|
||||
>>>>>>> master
|
||||
=======
|
||||
>>>>>>> master
|
||||
class PRelation
|
||||
{
|
||||
|
@ -266,6 +269,7 @@ class PComparison
|
|||
|
||||
public:
|
||||
PComparison()
|
||||
<<<<<<< HEAD
|
||||
<<<<<<< HEAD
|
||||
{
|
||||
op.setPOp("~");
|
||||
|
@ -275,6 +279,8 @@ class PComparison
|
|||
|
||||
PComparison(string str1, string str2, string str3)
|
||||
=======
|
||||
=======
|
||||
>>>>>>> master
|
||||
{
|
||||
op.setPOp("~");
|
||||
operand1.setPOperand("~");
|
||||
|
@ -289,6 +295,9 @@ class PComparison
|
|||
}
|
||||
|
||||
void setPComparison(string str1, string str2, string str3)
|
||||
<<<<<<< HEAD
|
||||
>>>>>>> master
|
||||
=======
|
||||
>>>>>>> master
|
||||
{
|
||||
operand1.setPOperand(str1);
|
||||
|
@ -296,6 +305,7 @@ class PComparison
|
|||
operand2.setPOperand(str3);
|
||||
}
|
||||
|
||||
<<<<<<< HEAD
|
||||
<<<<<<< HEAD
|
||||
void setPComparison(string str1, string str2, string str3)
|
||||
{
|
||||
|
@ -306,6 +316,10 @@ class PComparison
|
|||
|
||||
string getPComparison()
|
||||
{
|
||||
=======
|
||||
string getPComparison()
|
||||
{
|
||||
>>>>>>> master
|
||||
=======
|
||||
string getPComparison()
|
||||
{
|
||||
|
@ -418,6 +432,7 @@ class PExpression
|
|||
}
|
||||
};
|
||||
<<<<<<< HEAD
|
||||
<<<<<<< HEAD
|
||||
|
||||
|
||||
vector<string> tokenize(string ss)
|
||||
|
@ -909,3 +924,5 @@ void parse(string input, DBEngine &engine)
|
|||
|
||||
=======
|
||||
>>>>>>> master
|
||||
=======
|
||||
>>>>>>> master
|
||||
|
|
505
Parserv4.cpp
Normal file
505
Parserv4.cpp
Normal file
|
@ -0,0 +1,505 @@
|
|||
#include <string> // std::string
|
||||
#include <iostream> // std::cout
|
||||
#include <sstream> // std::stringstream
|
||||
#include <vector>
|
||||
#include <string>
|
||||
#include "Parserv3.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
vector<string> tokenize(string ss)
|
||||
{
|
||||
string tempString;
|
||||
stringstream lineStream(ss);
|
||||
vector<string> output;
|
||||
|
||||
while (lineStream >> tempString)
|
||||
{
|
||||
output.push_back(tempString);
|
||||
}
|
||||
|
||||
//testing---------------
|
||||
cout<<"TokenList: ";
|
||||
|
||||
for (int i = 0; i <output.size(); ++i)
|
||||
{
|
||||
cout<<output[i]<<" ";
|
||||
}
|
||||
//----------------------
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
void displayTokenList(vector<string> input)
|
||||
{
|
||||
cout<<"TokenList: "<<endl;
|
||||
for (int i = 0; i < input.size(); ++i)
|
||||
{
|
||||
cout<<input[i]<<endl;
|
||||
}
|
||||
}
|
||||
|
||||
vector<string> showCMD(vector<string> input)
|
||||
{
|
||||
if (input.size() > 3)
|
||||
{
|
||||
cout<<"Syntax error!"<<endl;
|
||||
}
|
||||
|
||||
PRelation r(input[0]);
|
||||
|
||||
// send show command to DBEngine
|
||||
|
||||
return input;
|
||||
}
|
||||
|
||||
vector<string> saveCMD(vector<string> input)
|
||||
{
|
||||
if (input.size() > 3)
|
||||
{
|
||||
cout<<"Syntax error!"<<endl;
|
||||
}
|
||||
|
||||
PRelation r(input[0]);
|
||||
|
||||
// send save command to DBEngine
|
||||
|
||||
return input;
|
||||
}
|
||||
|
||||
vector<string> closeCMD(vector<string> input)
|
||||
{
|
||||
if (input.size() > 3)
|
||||
{
|
||||
cout<<"Syntax error!"<<endl;
|
||||
}
|
||||
|
||||
PRelation r(input[0]);
|
||||
|
||||
// send close command to DBEngine
|
||||
|
||||
return input;
|
||||
}
|
||||
|
||||
vector<string> openCMD(vector<string> input)
|
||||
{
|
||||
if (input.size() > 2)
|
||||
{
|
||||
cout<<"Syntax error!"<<endl;
|
||||
}
|
||||
|
||||
PRelation r(input[0]);
|
||||
|
||||
// send open command to DBEngine
|
||||
|
||||
return input;
|
||||
}
|
||||
|
||||
vector<string> exitCMD(vector<string> input)
|
||||
{
|
||||
if (input[1] != ";")
|
||||
{
|
||||
cout<<"ERROR: missing semicolon!"<<endl;
|
||||
}
|
||||
|
||||
if (input[0] != "EXIT") { cout<<"Wrong function/syntax error!"<<endl;}
|
||||
cout<<"Passing command: "<<input[0]<<endl;
|
||||
|
||||
return input;
|
||||
}
|
||||
|
||||
|
||||
vector<string> createCMD(vector<string> input)
|
||||
{
|
||||
//relation name will be the first element of the vector of data returned by this function
|
||||
|
||||
if (input[0] == "CREATE" && input[1] == "TABLE")
|
||||
{
|
||||
input.erase(input.begin());
|
||||
input.erase(input.begin());
|
||||
|
||||
PRelation r;
|
||||
r.setPRelation(input[0]);
|
||||
|
||||
input.erase(input.begin());
|
||||
|
||||
if(input[0] == "(")
|
||||
{
|
||||
input.erase(input.begin());
|
||||
|
||||
//vector <PExpression> e1;
|
||||
|
||||
vector <PAttribute> a;
|
||||
|
||||
while(input[0] != ")") //inserting all values to relation
|
||||
{
|
||||
PAttribute temp;
|
||||
|
||||
if (input[0] == ",")
|
||||
{
|
||||
input.erase(input.begin());
|
||||
}
|
||||
|
||||
temp.setPAttributeName(input[0]);
|
||||
|
||||
input.erase(input.begin());
|
||||
|
||||
if(input[0] == "INTEGER")
|
||||
{
|
||||
temp.setPAttributeType(input[0]);
|
||||
input.erase(input.begin());
|
||||
}
|
||||
else
|
||||
{
|
||||
temp.setPAttributeType(input[0].substr(0,input[0].find("(")));
|
||||
temp.setPAttributeSize(stoi(input[0].substr(input[0].find("("), input[0].find(")"))));
|
||||
input.erase(input.begin());
|
||||
}
|
||||
|
||||
a.push_back(temp);
|
||||
}
|
||||
|
||||
vector <PAttribute> apk; //save primary keys temp storage
|
||||
|
||||
if(input[0] == "PRIMARY" && input[1] == "KEY")
|
||||
{
|
||||
input.erase(input.begin());
|
||||
input.erase(input.begin());
|
||||
|
||||
if(input[0] == "(")
|
||||
{
|
||||
|
||||
while(input[0] != ")") //inserting all values to relation
|
||||
{
|
||||
PAttribute temp;
|
||||
|
||||
if (input[0] == ",")
|
||||
{
|
||||
input.erase(input.begin());
|
||||
}
|
||||
|
||||
temp.setPAttributeName(input[0]);
|
||||
|
||||
apk.push_back(temp);
|
||||
|
||||
input.erase(input.begin());
|
||||
}
|
||||
|
||||
|
||||
|
||||
return input;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
else cout<<"Syntax error!"<<endl;
|
||||
}
|
||||
else cout<<"Syntax error!"<<endl;
|
||||
|
||||
}
|
||||
|
||||
vector<string> insertCMD(vector<string> input)
|
||||
{
|
||||
//relation name will be the first element of the vector of data returned by this function
|
||||
|
||||
if (input[0] == "INTO")
|
||||
{
|
||||
input.erase(input.begin());
|
||||
|
||||
PRelation r(input[0]);
|
||||
|
||||
input.erase(input.begin());
|
||||
|
||||
vector <string> s;
|
||||
|
||||
if (input[0] == "VALUES" && input[1] == "FROM")
|
||||
{
|
||||
input.erase(input.begin());
|
||||
input.erase(input.begin());
|
||||
|
||||
|
||||
if(input[0] == "(")
|
||||
{
|
||||
if(input[0].at(0) == '\"')
|
||||
{
|
||||
s.push_back(input[0].substr(1,input[0].find_last_of("\"")));
|
||||
}
|
||||
vector <PExpression> e;
|
||||
input.erase(input.begin());
|
||||
|
||||
while(input[0] != ")") //inserting all values to relation
|
||||
//for (int i = 0; i < 2; ++i)
|
||||
{
|
||||
if (input[0] == ",") input.erase(input.begin());
|
||||
|
||||
e.push_back(input[0]);
|
||||
|
||||
input.erase(input.begin());
|
||||
}
|
||||
|
||||
cout << "Inserting: ";
|
||||
while(!e.empty())
|
||||
{
|
||||
cout << e[0].getPExpression() << " ";
|
||||
e.erase(e.begin());
|
||||
}
|
||||
cout << "into " << r.getName() << ".\n";
|
||||
|
||||
return input;
|
||||
|
||||
}
|
||||
|
||||
else if (input[0] == "RELATION")
|
||||
{
|
||||
input.erase(input.begin());
|
||||
|
||||
PExpression e;
|
||||
|
||||
while(input[0] != ";")
|
||||
{
|
||||
e.setPExpression(e.getPExpression() + input[0]);
|
||||
}
|
||||
|
||||
cout << "Inserting: " << e.getPExpression() << " into " << r.getName() << ".\n";
|
||||
|
||||
return input;
|
||||
}
|
||||
|
||||
else cout<<"Syntax error!"<<endl;
|
||||
}
|
||||
|
||||
cout<<"Syntax error!"<<endl;
|
||||
|
||||
}
|
||||
|
||||
else cout<<"Syntax error!"<<endl;
|
||||
|
||||
}
|
||||
|
||||
vector<string> updateCMD(vector<string> input)
|
||||
{
|
||||
PRelation r(input[0]);
|
||||
|
||||
input.erase(input.begin());
|
||||
|
||||
if(input[0] == "SET")
|
||||
{
|
||||
input.erase(input.begin());
|
||||
|
||||
//parse out ( and send everything until ) into an Expression vector
|
||||
if(input[0] == "(")
|
||||
{
|
||||
|
||||
vector <PAttribute> a;
|
||||
PAttribute temp;
|
||||
|
||||
vector <string> s;
|
||||
|
||||
//vector <PExpression> e;
|
||||
|
||||
input.erase(input.begin());
|
||||
|
||||
while(input[0] != ")")
|
||||
{
|
||||
temp.setPAttributeName(input[0]);
|
||||
a.push_back(temp);
|
||||
temp.setPAttributeName("~");
|
||||
|
||||
input.erase(input.begin());
|
||||
|
||||
if(input[0] == "=")
|
||||
{
|
||||
input.erase(input.begin());
|
||||
|
||||
s.push_back(input[0]);
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
cout<<"Syntax error!"<<endl;
|
||||
}
|
||||
|
||||
if(input[0] == ",")
|
||||
{
|
||||
input.erase(input.begin());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(input[0] == "WHERE")
|
||||
{
|
||||
if(input[0] == "(")
|
||||
{
|
||||
//PCondition c;
|
||||
|
||||
PComparison c;
|
||||
POperand oops1;
|
||||
POperand oops2;
|
||||
POp op;
|
||||
|
||||
while(input[0] != ")")
|
||||
{
|
||||
oops1.setPOperand(input[0]);
|
||||
input.erase(input.begin());
|
||||
|
||||
oops2.setPOperand(input[0]);
|
||||
input.erase(input.begin());
|
||||
|
||||
op.setPOp(input[0]);
|
||||
input.erase(input.begin());
|
||||
|
||||
c.setPComparison(oops1.getPOperand(), op.getPOp(), oops2.getPOperand());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// send update command to DBEngine
|
||||
}
|
||||
|
||||
else cout<<"Syntax error!"<<endl;
|
||||
}
|
||||
|
||||
vector<string> deleteCMD(vector<string> input)
|
||||
{
|
||||
if (input[0] == "DELETE" && input[1] == "FROM")
|
||||
{
|
||||
input.erase(input.begin());
|
||||
input.erase(input.begin());
|
||||
|
||||
PRelation r(input[0]);
|
||||
|
||||
if(input[0] == "WHERE")
|
||||
{
|
||||
if(input[0] == "(")
|
||||
{
|
||||
//PCondition c;
|
||||
|
||||
PComparison c;
|
||||
POperand oops1;
|
||||
POperand oops2;
|
||||
POp op;
|
||||
|
||||
while(input[0] != ")")
|
||||
{
|
||||
oops1.setPOperand(input[0]);
|
||||
input.erase(input.begin());
|
||||
|
||||
oops2.setPOperand(input[0]);
|
||||
input.erase(input.begin());
|
||||
|
||||
op.setPOp(input[0]);
|
||||
input.erase(input.begin());
|
||||
|
||||
c.setPComparison(oops1.getPOperand(), op.getPOp(), oops2.getPOperand());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// send delete command to DBEngine
|
||||
}
|
||||
else cout<<"Syntax error!"<<endl;
|
||||
}
|
||||
|
||||
void par_line(vector<string> input) //calls par_command() or par_query() depending on first item from token list
|
||||
{
|
||||
/*
|
||||
• 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 != ";")
|
||||
{
|
||||
cout<<"ERROR! missing semicolon "<<endl;
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
if ( input[0] == "INSERT")
|
||||
{
|
||||
cout<<"\nPassing the following arguments to dbEngine: \nCommand: "<<input[0]<<endl;
|
||||
input.erase(input.begin());
|
||||
vector<string> insertInput = insertCMD(input);
|
||||
cout<<"arguments: "<<endl;
|
||||
displayTokenList(insertInput);
|
||||
|
||||
}
|
||||
|
||||
if ( input[0] == "CREATE")
|
||||
{
|
||||
cout<<"\nPassing the following arguments to dbEngine: \nCommand: "<<input[0]<<endl;
|
||||
input.erase(input.begin());
|
||||
|
||||
vector<string> insertInput = createCMD(input);
|
||||
cout<<"arguments: "<<endl;
|
||||
displayTokenList(insertInput);
|
||||
|
||||
}
|
||||
|
||||
if ( input[0] == "DELETE")
|
||||
{
|
||||
cout<<"\nPassing the following arguments to dbEngine: \nCommand: "<<input[0]<<endl;
|
||||
input.erase(input.begin());
|
||||
|
||||
vector<string> insertInput = deleteCMD(input);
|
||||
cout<<"arguments: "<<endl;
|
||||
displayTokenList(insertInput);
|
||||
|
||||
}
|
||||
|
||||
if ( input[0] == "UPDATE")
|
||||
{
|
||||
cout<<"\nPassing the following arguments to dbEngine: \nCommand: "<<input[0]<<endl;
|
||||
input.erase(input.begin());
|
||||
|
||||
vector<string> insertInput = updateCMD(input);
|
||||
cout<<"arguments: "<<endl;
|
||||
displayTokenList(insertInput);
|
||||
|
||||
}
|
||||
|
||||
if ( input[0] == "SHOW")
|
||||
{
|
||||
showCMD(input);
|
||||
}
|
||||
|
||||
if ( input[0] == "EXIT")
|
||||
{
|
||||
exitCMD(input);
|
||||
}
|
||||
|
||||
if ( input[0] == "OPEN")
|
||||
{
|
||||
openCMD(input);
|
||||
}
|
||||
|
||||
if ( input[0] == "SAVE")
|
||||
{
|
||||
saveCMD(input);
|
||||
}
|
||||
|
||||
if ( input[0] == "CLOSE")
|
||||
{
|
||||
closeCMD(input);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int main () {
|
||||
|
||||
|
||||
string ss = "INSERT INTO animals VALUES FROM ( Joe , cat , 4 ) ;";
|
||||
string ss2 = "SHOW Dogs ;";
|
||||
string ss3 = "EXIT ; ";
|
||||
|
||||
vector<string> listOfTokens = tokenize(ss);
|
||||
vector<string> listOfTokens2 = tokenize(ss2);
|
||||
vector<string> listOfTokens3 = tokenize(ss3);
|
||||
|
||||
par_line(listOfTokens);
|
||||
par_line(listOfTokens2);
|
||||
par_line(listOfTokens3);
|
||||
|
||||
|
||||
}
|
BIN
test
Executable file
BIN
test
Executable file
Binary file not shown.
11
test.cpp
11
test.cpp
|
@ -1,10 +1,14 @@
|
|||
#include <iostream>
|
||||
#include <vector>
|
||||
<<<<<<< HEAD
|
||||
<<<<<<< HEAD
|
||||
#include "Parserv3.h"
|
||||
=======
|
||||
#include "Condition.h"
|
||||
>>>>>>> master
|
||||
=======
|
||||
#include "Condition.h"
|
||||
>>>>>>> master
|
||||
#include "DBEngine.h"
|
||||
|
||||
using namespace std;
|
||||
|
@ -32,6 +36,7 @@ int main() {
|
|||
v.push_back(att2);
|
||||
v.push_back(att3);
|
||||
|
||||
<<<<<<< HEAD
|
||||
<<<<<<< HEAD
|
||||
Relation r("Food", v);
|
||||
//r.renameAttribute("Breakfast", "BFST");
|
||||
|
@ -100,6 +105,9 @@ int main () {
|
|||
|
||||
=======
|
||||
engine.createTable("Food", v);
|
||||
=======
|
||||
engine.createTable("Food", v);
|
||||
>>>>>>> master
|
||||
|
||||
Attribute att4("Breakfast", "VARCHAR(20)", true);
|
||||
Attribute att5("Lunch", "VARCHAR(20)", false);
|
||||
|
@ -123,5 +131,8 @@ int main () {
|
|||
engine.createTable("MoarFood", v2);
|
||||
|
||||
engine.setUnion(engine.getTableFromName("Food"), engine.getTableFromName("MoarFood")).display();
|
||||
<<<<<<< HEAD
|
||||
>>>>>>> master
|
||||
=======
|
||||
>>>>>>> master
|
||||
}
|
||||
|
|
Reference in a new issue