Doing things.

This commit is contained in:
Alexander Huddleston 2015-09-28 17:02:04 -05:00
parent b5093be722
commit 7c8eb084d9
6 changed files with 20 additions and 16 deletions

View file

@ -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){

View file

@ -10,6 +10,7 @@ class Attribute{
string type;
bool key;
int size;
int limit;
public:
Attribute();

View file

@ -25,7 +25,7 @@ void DBEngine::createTable(Relation r){
size++;
}
void DBEngine::insertValues(string r, vector <string> v)
void DBEngine::insertValues(string r, vector<string> v)
{
for(int i = 0; i < tables.size(); i++)
{
@ -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(){

View file

@ -21,22 +21,13 @@ public:
Relation& getTableFromName(string n);
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);
Relation projection(vector<string> input, Relation r);
Relation product(string s1, Relation r1, Relation r2);
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
Relation crossProduct(Relation r1, Relation r2);
};

BIN
test

Binary file not shown.

View file

@ -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: ";
}
}