Skip to content
Permalink
d1185e1ea9
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
80 lines (68 sloc) 1.63 KB
#ifndef SELECT1_DB_H
#define SELECT1_DB_H
#include <iostream>
#include <string>
#include <cstring>
#include <vector>
#include <list>
#include "libsqlite.hpp"
#include "insert1_db.h"
using namespace std;
class select1_db
{
protected:
std::vector<string> modules, classes, lecturers, rooms;
std::vector<int> startTiming, endTiming, studentID;
std::vector<string> name, surname, username, email, password;
public:
select1_db(){
try
{
sqlite::sqlite db("Timetable.db");
auto cur = db.get_statement();
cur->set_sql("SELECT * FROM WORK");
cur->prepare();
while (cur->step()){
studentID.push_back(cur->get_int(0));
modules.push_back(cur->get_text(1));
classes.push_back(cur->get_text(2));
lecturers.push_back(cur->get_text(3));
rooms.push_back(cur->get_text(4));
startTiming.push_back(cur->get_int(5));
endTiming.push_back(cur->get_int(6));
}
}
catch( sqlite::exception e ){
cerr << e.what() << endl;
}
}
std::vector<int> get_studentID(){
select1_db();
return studentID;
}
std::vector<std::string> get_modules(){
select1_db();
return modules;
}
std::vector<std::string> get_classes(){
select1_db();
return classes;
}
std::vector<std::string> get_lecturers(){
select1_db();
return lecturers;
}
std::vector<std::string> get_rooms(){
select1_db();
return rooms;
}
std::vector<int> get_startTiming(){
select1_db();
return startTiming;
}
std::vector<int> get_endTiming(){
select1_db();
return endTiming;
}
};
#endif