-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdbinterface.h
More file actions
37 lines (29 loc) · 821 Bytes
/
Copy pathdbinterface.h
File metadata and controls
37 lines (29 loc) · 821 Bytes
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
#ifndef DBINTERFACE_H
#define DBINTERFACE_H
#include <QSqlDatabase>
#include <QSqlQuery>
#include <QSqlError>
#include <QString>
#include <QVector>
struct Data{ // My own data structure for easier work with data in DB
int code;
QString name;
QString description;
int quantity;
QString pathImg;
};
class DBInterface
{
QVector<Data> * AllData = nullptr; // Temporarily stored data from DB
QSqlDatabase db;
public:
DBInterface();
bool addData(const int code,const QString name,const QString description,const int quantity,const QString pathImg);
bool addData(const Data MyData);
const QVector<Data> * getAllData (void);
void UpdateDB();
void UpdateRow(Data * change);
void DeleteRow(int idRow);
~DBInterface();
};
#endif // DBINTERFACE_H