2015-09-25 00:30:32 -05:00
|
|
|
#pragma once
|
2015-09-15 16:30:25 -05:00
|
|
|
#include <fstream>
|
|
|
|
#include <iostream>
|
|
|
|
#include <vector>
|
|
|
|
#include "Relation.h"
|
|
|
|
|
2015-09-15 23:48:50 -05:00
|
|
|
//still in progress
|
2015-09-17 18:30:45 -05:00
|
|
|
class DBEngine{
|
2015-09-15 21:31:19 -05:00
|
|
|
vector<Relation> tables;
|
2015-09-25 00:30:32 -05:00
|
|
|
vector<string> commands;
|
2015-09-15 23:48:50 -05:00
|
|
|
int size;
|
2015-09-25 00:30:32 -05:00
|
|
|
|
2015-09-15 16:30:25 -05:00
|
|
|
public:
|
2015-09-17 18:30:45 -05:00
|
|
|
DBEngine();
|
|
|
|
void createTable(string n);
|
|
|
|
void createTable(string n, vector<Attribute> a);
|
|
|
|
void createTable(Relation r);
|
2015-09-27 23:24:02 -05:00
|
|
|
void insertValues(string r, vector <string> v);
|
2015-09-17 18:30:45 -05:00
|
|
|
vector<Relation> getRelations();
|
2015-09-29 12:00:37 -05:00
|
|
|
bool isRelation(string n);
|
2015-09-17 18:30:45 -05:00
|
|
|
//void showTable(Relation r);
|
2015-09-22 09:03:42 -05:00
|
|
|
Relation& getTableFromName(string n);
|
2015-09-17 18:30:45 -05:00
|
|
|
void saveToFile(vector<string> cmds);
|
2015-09-25 00:30:32 -05:00
|
|
|
Relation selection(string attName, string s, Relation r);
|
2015-09-28 17:02:04 -05:00
|
|
|
Relation projection(vector<string> input, Relation r);
|
2015-09-28 18:47:43 -05:00
|
|
|
Relation product(string s1, Relation r1, Relation r2);
|
|
|
|
void deleteRelation(string n);
|
2015-09-25 00:30:32 -05:00
|
|
|
void save();
|
2015-09-28 16:18:49 -05:00
|
|
|
void save(string n);
|
2015-09-28 15:57:57 -05:00
|
|
|
void storeCommands(string s);
|
2015-09-22 09:03:42 -05:00
|
|
|
void rename(Relation& r, vector<string> oldnames, vector<string> newnames);
|
2015-09-24 21:00:31 -05:00
|
|
|
Relation setUnion(Relation r1, Relation r2);
|
2015-09-26 07:09:44 -05:00
|
|
|
Relation setDiff(Relation r1, Relation r2);
|
2015-09-28 17:02:04 -05:00
|
|
|
Relation crossProduct(Relation r1, Relation r2);
|
2015-09-15 16:30:25 -05:00
|
|
|
};
|