165 lines
2.9 KiB
C
165 lines
2.9 KiB
C
![]() |
#include <iostream>
|
||
|
#include <sstream>
|
||
|
#include <string>
|
||
|
#include <vector>
|
||
|
#include "DBEngine.h"
|
||
|
|
||
|
using namespace std;
|
||
|
|
||
|
class PRelation{
|
||
|
string name;
|
||
|
|
||
|
public:
|
||
|
PRelation(){ name = "~"; }
|
||
|
PRelation(string str){ name = str; }
|
||
|
void setPRelation(string str){ name = str; }
|
||
|
string getName(){ return name; }
|
||
|
};
|
||
|
|
||
|
class PAttribute{
|
||
|
string name;
|
||
|
string type;
|
||
|
bool key;
|
||
|
int size;
|
||
|
|
||
|
public:
|
||
|
PAttribute();
|
||
|
PAttribute(string str, string t);
|
||
|
PAttribute(string str, string t, int s);
|
||
|
void setPAttributeName(string str){ name = str; }
|
||
|
void setPAttributeType(string t){ type = t; }
|
||
|
void setPAttributeKey(){ key = true; }
|
||
|
void setPAttributeSize(int s){ size = s; }
|
||
|
string getPAttribute(){ return name; }
|
||
|
string getPAttributeType(){ return type; }
|
||
|
bool getPAttributeKey(){ return key; }
|
||
|
int getPAttributeSize(){ return size; }
|
||
|
};
|
||
|
|
||
|
class PUnion{
|
||
|
string Un1;
|
||
|
string Un2;
|
||
|
|
||
|
public:
|
||
|
PUnion();
|
||
|
PUnion(string s1, string s2);
|
||
|
string getPUnion();
|
||
|
};
|
||
|
|
||
|
class PProduct{
|
||
|
string Pr1;
|
||
|
string Pr2;
|
||
|
|
||
|
public:
|
||
|
PProduct();
|
||
|
PProduct(string s1, string s2);
|
||
|
string getPProduct();
|
||
|
};
|
||
|
|
||
|
class PDifference{
|
||
|
string D1;
|
||
|
string D2;
|
||
|
|
||
|
public:
|
||
|
PDifference();
|
||
|
PDifference(string s1, string s2);
|
||
|
string getPDifference();
|
||
|
};
|
||
|
|
||
|
class PRenaming{
|
||
|
string newName;
|
||
|
string oldName;
|
||
|
|
||
|
public:
|
||
|
PRenaming();
|
||
|
PRenaming(string s1, string s2);
|
||
|
string doRename();
|
||
|
};
|
||
|
|
||
|
class PProjection{
|
||
|
string newName;
|
||
|
string oldName;
|
||
|
|
||
|
public:
|
||
|
PProjection();
|
||
|
PProjection(string s1, string s2);
|
||
|
string doPProjection();
|
||
|
};
|
||
|
|
||
|
class POperand{
|
||
|
string op;
|
||
|
|
||
|
public:
|
||
|
POperand(){ op = "~"; }
|
||
|
POperand(string str){ op = str; }
|
||
|
void setPOperand(string str){ op = str; }
|
||
|
string getPOperand(){ return op; }
|
||
|
};
|
||
|
|
||
|
class POp{
|
||
|
string op;
|
||
|
|
||
|
public:
|
||
|
POp(){ op = "~"; }
|
||
|
POp(string str){ op = str; }
|
||
|
void setPOp(string str){ op = str; }
|
||
|
string getPOp(){ return op; }
|
||
|
};
|
||
|
|
||
|
class PComparison{
|
||
|
POp op;
|
||
|
POperand operand1;
|
||
|
POperand operand2;
|
||
|
|
||
|
public:
|
||
|
PComparison();
|
||
|
PComparison(string str1, string str2, string str3);
|
||
|
void setPComparison(string str1, string str2, string str3);
|
||
|
string getPComparison();
|
||
|
};
|
||
|
|
||
|
class PConjunction{
|
||
|
string conj;
|
||
|
|
||
|
public:
|
||
|
PConjunction(){ conj = "~"; }
|
||
|
PConjunction(string str){ conj = str; }
|
||
|
void setPConjunction(string str){ conj = str; }
|
||
|
string getPConjunction(){ return conj; }
|
||
|
};
|
||
|
|
||
|
class PCondition{
|
||
|
string cond;
|
||
|
|
||
|
public:
|
||
|
PCondition(){ cond = "~"; }
|
||
|
PCondition(string str){ cond = str; }
|
||
|
void setPCondition(string str){ cond = str; }
|
||
|
string getPCondition(){ return cond; }
|
||
|
};
|
||
|
|
||
|
class PSelection{
|
||
|
string select;
|
||
|
|
||
|
public:
|
||
|
PSelection(){ select = "~"; }
|
||
|
PSelection(string str){ select = str; }
|
||
|
string getPSelection(){ return select; }
|
||
|
};
|
||
|
|
||
|
class PExpression{
|
||
|
PRelation rel;
|
||
|
PSelection sel;
|
||
|
PProjection proj;
|
||
|
PRenaming ren;
|
||
|
PUnion un;
|
||
|
PDifference diff;
|
||
|
PProduct prod;
|
||
|
string temp;
|
||
|
|
||
|
public:
|
||
|
PExpression();
|
||
|
PExpression(string str){ temp = str; }
|
||
|
void setPExpression(string str){ temp = str; }
|
||
|
string getPExpression(){ return temp; }
|
||
|
};
|