-
Notifications
You must be signed in to change notification settings - Fork 0
/
mysql.h
43 lines (33 loc) · 830 Bytes
/
mysql.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
35
36
37
38
39
40
41
42
43
#ifndef MYSQL_H
#define MYSQL_H
#include <QObject>
#include <QtQml/qqmlregistration.h>
#include <QSqlQueryModel>
class MySQL : public QObject
{
Q_OBJECT
QML_ELEMENT
Q_PROPERTY(QString dsn READ getDSN WRITE setDSN NOTIFY dsnChanged)
Q_PROPERTY(QString database READ getDatabase WRITE setDatabase NOTIFY databaseChanged)
public:
MySQL();
~MySQL();
QString getDSN();
void setDSN(QString dsn);
QString getDatabase();
void setDatabase(const QString &database);
public:
Q_INVOKABLE QStringList getDatabases();
Q_INVOKABLE QStringList getTables();
public slots:
void connect();
void disconnect();
signals:
void dsnChanged();
void databaseChanged();
private:
QString m_database{};
QString m_dsn{};
QSqlDatabase m_connection;
};
#endif // LOGINSERVICE_H