2020-08-08 11:44:16 +00:00
|
|
|
#include "session.h"
|
|
|
|
|
|
|
|
Session::Session(QObject *parent) : QObject(parent)
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
Session::~Session() {
|
|
|
|
unload();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void Session::load(std::filesystem::path path)
|
|
|
|
{
|
|
|
|
if(db) {
|
|
|
|
unload();
|
|
|
|
}
|
|
|
|
auto rc = sqlite3_open(path.c_str(), &db);
|
|
|
|
if(rc) {
|
|
|
|
qDebug("cannot open database");
|
2020-08-09 12:07:14 +00:00
|
|
|
qDebug() << sqlite3_errmsg(db);
|
2020-08-08 11:44:16 +00:00
|
|
|
unload();
|
|
|
|
throw;
|
|
|
|
}
|
2020-08-09 12:07:14 +00:00
|
|
|
// check if tables exist
|
|
|
|
// create tables or add history
|
2020-08-08 11:44:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void Session::unload() {
|
|
|
|
if(db) {
|
|
|
|
sqlite3_close(db);
|
|
|
|
}
|
|
|
|
}
|
2020-08-09 12:07:14 +00:00
|
|
|
|
2020-08-13 03:35:22 +00:00
|
|
|
void Session::saveRequest(http::Flow flow) {
|
2020-08-09 12:07:14 +00:00
|
|
|
// todo
|
|
|
|
}
|