-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathutilitydb.h
34 lines (29 loc) · 1.02 KB
/
utilitydb.h
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
#ifndef UTILITYDB_H
#define UTILITYDB_H
#include <QtSql>
#include <QSqlDatabase>
#include <QSqlTableModel>
#include <qmessagebox.h>
#include "schedule.h"
class UtilityDB
{
public:
UtilityDB();
bool isConnected();
bool doesTableExist(QString tableName);
void clearTable(QString tableName);
void dropTable(QString tableName);
void createScheduleTable(QString tableName);
Schedule getScheduleByTableName(QString tableName);
void insertScheduleToTable(QString tableName, Schedule schedule);
Schedule getScheduleByTableNameInRange(QString tableName, QDate startDate, QDate endDate);
private:
QSqlDatabase db;
void establishConnection();
QString decorateTableName(QString tableName);
QString DB_DRIVER_NAME = "QSQLITE";
//const QString DB_FILE_PATH = "./../../../../PNU-Schedule/database/schedule.db";
// My (YuraRov) DB_FILE_PATH, others should comment the line below and uncomment above
const QString DB_FILE_PATH = "./../PNU-Schedule/database/schedule.db";
};
#endif // UTILITYDB_H