This repository has been archived on 2025-04-11. You can view files and clone it, but cannot push or open issues or pull requests.
dmspine64backup/test.cpp
Rebecca Schofield e2776d2459 to turn in
2015-09-15 23:44:58 -05:00

96 lines
2.3 KiB
C++
Executable file

#include <iostream>
#include <vector>
#include "DBEngine.h"
using namespace std;
//still in progress
int main() {
DBEngine engine;
/*Attribute att1("shamWow", "VARCHAR(10)", true);
att1.addRow("rag");
att1.addRow("sponge");
att1.addRow("wooow");
att1.addRow("cloth");
Attribute att2("doom", "VARCHAR(20)", false);
att2.addRow("zombieman");
att2.addRow("revenant");
att2.addRow("imp");
att2.addRow("archvile");
vector<Attribute> vec;
vec.push_back(att1);
vec.push_back(att2);*/
Attribute att3("name", "VARCHAR(20)", true);
att3.addRow("Fry");
att3.addRow("Bender");
att3.addRow("Leela");
att3.addRow("Zoidberg");
Attribute att4("age", "INTEGER", false);
att4.addRow("22");
att4.addRow("5");
att4.addRow("22");
att4.addRow("50");
vector<Attribute> vec2;
vec2.push_back(att3);
vec2.push_back(att4);
//beginning testing of core DB functions
cout << "\a";
engine.createTable("table1", vec2);
cout << "\a";
//engine.createTable("table2", vec);
engine.showTable(engine.getTableFromName("table1"));
cout << "\n\n";
cout << "\a";
/*Attribute att5("name", "VARCHAR(20)", true);
att5.addRow("Yrf");
att5.addRow("Redneb");
att5.addRow("Aleel");
att5.addRow("Grebdoiz");
cout << "\a";
Attribute att6("age", "INTEGER", false);
att6.addRow("44");
att6.addRow("10");
att6.addRow("44");
att6.addRow("100");
vector<Attribute> vec3;
vec3.push_back(att5);
vec3.push_back(att6);
engine.createTable("table3", vec3);*/
//cout << "\n";
//cout << engine.unionComp(engine.getTableFromName("table1"), engine.getTableFromName("table2"));
//cout << engine.unionComp(engine.getTableFromName("table1"), engine.getTableFromName("table3"));
//cout << "\n";
//engine.project((engine.getTableFromName("table1")), "name");
/*vector<string> cmds;
cmds.push_back("CREATE TABLE animals (name VARCHAR(20), kind VARCHAR(8), years INTEGER) PRIMARY KEY (name, kind);");
cmds.push_back("SHOW animals;");
engine.saveToFile(cmds);*/
vector<string> t;
t.push_back("Professor");
t.push_back("180");
//engine.insertTuple((engine.getTableFromName("table1")), t);
//engine.deleteTuple((engine.getTableFromName("table1")), 2);
cout << "\n\n";
engine.showTable((engine.getTableFromName("table1")));
}