-
Notifications
You must be signed in to change notification settings - Fork 0
/
database.cpp
36 lines (28 loc) · 882 Bytes
/
database.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#include "database.h"
Database::Database()
{
// create database path
this->path = QApplication::applicationDirPath() + "/database/administration.sqlite";
// initialise database with given path
this->db = QSqlDatabase::addDatabase("QSQLITE");
this->db.setDatabaseName(this->path);
}
Database::Database(QString path)
{
// create database path
this->path = QApplication::applicationDirPath() + path;
// initialise database with given path
this->db = QSqlDatabase::addDatabase("QSQLITE");
this->db.setDatabaseName(this->path);
}
Database::~Database()
{
}
void Database::reinit()
{
// create database path
this->path = QApplication::applicationDirPath() + "/database/administration.sqlite";
// initialise database with given path
this->db = QSqlDatabase::addDatabase("QSQLITE");
this->db.setDatabaseName(this->path);
}