Doing things.
This commit is contained in:
parent
b5093be722
commit
7c8eb084d9
6 changed files with 20 additions and 16 deletions
|
@ -7,6 +7,7 @@ Attribute::Attribute(){
|
|||
type = "";
|
||||
key = 0;
|
||||
size = 0;
|
||||
limit = 0;
|
||||
}
|
||||
|
||||
Attribute::Attribute(string n, string t, bool k){
|
||||
|
@ -14,13 +15,15 @@ Attribute::Attribute(string n, string t, bool k){
|
|||
type = t;
|
||||
key = k;
|
||||
size = 0;
|
||||
limit = 20;
|
||||
}
|
||||
|
||||
Attribute::Attribute(string n, string t, bool k, int s){
|
||||
name = n;
|
||||
type = t;
|
||||
key = k;
|
||||
size = s;
|
||||
size = 0;
|
||||
limit = s;
|
||||
}
|
||||
|
||||
void Attribute::addCell(string v){
|
||||
|
|
|
@ -10,6 +10,7 @@ class Attribute{
|
|||
string type;
|
||||
bool key;
|
||||
int size;
|
||||
int limit;
|
||||
|
||||
public:
|
||||
Attribute();
|
||||
|
|
|
@ -58,11 +58,12 @@ void DBEngine::save(string n){
|
|||
string name = n + ".txt";
|
||||
file.open(name);
|
||||
|
||||
for(int i = 0; i < commands.size(); ++i){
|
||||
for(int i = 0; i < commands.size(); ++i)
|
||||
{
|
||||
file << commands[i] << endl;
|
||||
}
|
||||
|
||||
file.close();
|
||||
//file.close();
|
||||
}
|
||||
|
||||
vector<Relation> DBEngine::getRelations(){
|
||||
|
|
|
@ -22,21 +22,12 @@ public:
|
|||
void saveToFile(vector<string> cmds);
|
||||
Relation selection(string attName, string s, Relation r);
|
||||
Relation projection(vector<string> input, Relation r);
|
||||
<<<<<<< HEAD
|
||||
Relation product(string s1, Relation r1, Relation r2);
|
||||
void rename(Relation& r, vector<string> oldnames, vector<string> newnames);
|
||||
void save();
|
||||
void save(string n);
|
||||
void storeCommands(string s);
|
||||
Relation setUnion(Relation r1, Relation r2);
|
||||
//void setDiff();
|
||||
//void crossProduct();
|
||||
=======
|
||||
void save();
|
||||
void storeCommands(string s);
|
||||
void rename(Relation& r, vector<string> oldnames, vector<string> newnames);
|
||||
Relation setUnion(Relation r1, Relation r2);
|
||||
Relation setDiff(Relation r1, Relation r2);
|
||||
Relation crossProduct(Relation r1, Relation r2);
|
||||
>>>>>>> master
|
||||
};
|
||||
|
|
BIN
test
BIN
test
Binary file not shown.
8
test.cpp
8
test.cpp
|
@ -48,4 +48,12 @@ int main () {
|
|||
//engine.getTableFromName("MoarFood").display();
|
||||
|
||||
engine.crossProduct(engine.getTableFromName("Food"), engine.getTableFromName("MoarFood")).display();
|
||||
string x;
|
||||
cout << "Enter DBMS Commands: ";
|
||||
while(getline(cin, x))
|
||||
{
|
||||
//cout << x << endl;
|
||||
parse(x, engine);
|
||||
cout << "Enter DBMS Commands: ";
|
||||
}
|
||||
}
|
||||
|
|
Reference in a new issue