forked from IPP-Projekt/Uczelnia_z_bibloteka_klas
-
Notifications
You must be signed in to change notification settings - Fork 0
/
databaselibrary.h
30 lines (27 loc) · 987 Bytes
/
databaselibrary.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
#ifndef DATABASELIBRARY_H
#define DATABASELIBRARY_H
#include "QVector"
#include "QtSql/QSql"
#include "QtSql/QSqlDatabase"
#include "QtSql/QSqlTableModel"
#include "QtSql/QSqlDriver"
#include "QDebug"
#include "QtSql/QSqlRecord"
#include "QtSql"
class DatabaseLibrary
{
protected:
QSqlDatabase m_database = QSqlDatabase::addDatabase("QSQLITE");
public:
DatabaseLibrary();
~DatabaseLibrary() {cDisconnectDatabase();}
bool cConnectDatabase(QString hostName, QString databaseName, QString userName, QString password);
void cDisconnectDatabase();
QSqlTableModel *cModel (QString table, int numOfColumns, QString* Columns);
QSqlTableModel *cModel (QString table);
static bool cInsertRecord(QSqlTableModel* model, QSqlRecord& record);
static int cGenerateIndex(QSqlTableModel* model);
static void cRefeshModel(QSqlTableModel* model);
static void cChangeRecord(QSqlTableModel* model, QSqlRecord& record, int index);
};
#endif // DATABASELIBRARY_H