-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdatabase.h
More file actions
46 lines (37 loc) · 1.05 KB
/
database.h
File metadata and controls
46 lines (37 loc) · 1.05 KB
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
37
38
39
40
41
42
43
44
45
46
#ifndef DATABASE_H
#define DATABASE_H
#include <QtSql/QSqlDatabase>
#include <QtSql/QSql>
#include <QtSql/QSqlQuery>
#include<QVariant>
#include<QSql>
#include<QSqlRecord>
#include "subscriber.h"
#include "library.h"
#include "content.h"
#include "transaction.h"
class Database
{
private:
public:
Database();
static QSqlDatabase db;
bool init();
//***** for inserting data into database
bool saveContent(Content cnt);
bool saveSubscriber(Subscriber sb);
bool saveLibrary(Library lb);
bool saveTransaction(Transaction tr);
bool removeContent(int id);
bool removeSubscriber(int id);
bool removeLibrary(int id);
bool updateContent(int id, Content ct);
bool updateSubscriber(int id, Subscriber sb);
bool updateLibrary(int id, Library lb);
bool updateTransaction(Transaction prev, Transaction next);
std::vector<Content*> loadContents();
std::vector<Library*> loadLibraries();
std::vector<Subscriber*> loadSubscribers();
std::vector<Transaction*> loadTransactions();
};
#endif // DATABASE_H