2015-09-30 17:10:16 -05:00
|
|
|
#pragma once
|
|
|
|
#include <fstream>
|
|
|
|
#include <iostream>
|
|
|
|
#include <vector>
|
|
|
|
#include "Relation.h"
|
|
|
|
|
|
|
|
//still in progress
|
|
|
|
class DBEngine{
|
|
|
|
vector<Relation> tables;
|
|
|
|
vector<string> commands;
|
|
|
|
int size;
|
|
|
|
|
|
|
|
public:
|
|
|
|
DBEngine();
|
|
|
|
void createTable(string n);
|
|
|
|
void createTable(string n, vector<Attribute> a);
|
|
|
|
void createTable(Relation r);
|
|
|
|
void insertValues(string r, vector <string> v);
|
|
|
|
vector<Relation> getRelations();
|
|
|
|
bool isRelation(string n);
|
|
|
|
Relation& getTableFromName(string n);
|
|
|
|
void saveToFile(vector<string> cmds);
|
|
|
|
Relation selection(string attName, string s, Relation r);
|
2015-10-05 15:23:49 -05:00
|
|
|
Relation projection(vector<string> input, Relation r);
|
2015-09-30 17:10:16 -05:00
|
|
|
Relation product(string s1, Relation r1, Relation r2);
|
2015-10-05 15:23:49 -05:00
|
|
|
void deleteRelation(string n);
|
2015-09-30 17:10:16 -05:00
|
|
|
void save();
|
|
|
|
void save(string n);
|
|
|
|
void storeCommands(string s);
|
|
|
|
Relation rename(vector<string> newnames, Relation &r);
|
|
|
|
Relation setUnion(Relation r1, Relation r2);
|
2015-10-05 15:23:49 -05:00
|
|
|
Relation setDiff(Relation r1, Relation r2);
|
2015-09-30 16:48:54 -05:00
|
|
|
Relation crossProduct(Relation r1, Relation r2);
|
2015-10-05 15:23:49 -05:00
|
|
|
Relation updateCmd(Relation r, string attNameSet, string attSet, string attNameWhere, string attWhere);
|
2015-10-06 13:07:31 -05:00
|
|
|
//Relation deleteCmd(Relation r, string attName, string att);
|
|
|
|
void deleteCmd(string relationName, string attName, string att);
|
2015-09-30 17:10:16 -05:00
|
|
|
};
|