-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathedbconnection.h
59 lines (46 loc) · 1.66 KB
/
edbconnection.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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#ifndef EDBCONNECTION_H
#define EDBCONNECTION_H
#include <QSqlDatabase>
#include <QtCore>
class EDBconnection : public QObject
{
Q_OBJECT
public:
static EDBconnection* getInstance();
// static void destroyInstance();
~EDBconnection();
static QString escape(const QString q);
bool query(const QString) const;
int insert(const QString) const;
QList<QStringList> get(const QString) const;
QString get_dbHost(void) const { return dbHost; }
QString get_dbName(void) const { return dbName; }
QString get_dbUser(void) const { return dbUser; }
QString get_dbPass(void) const { return dbPass; }
public slots:
// void query(const QString) const;
// void select(const QString);// const;
void checkUser(QString login, QString pwd = "ANY");
// newUser(login, pass, lastname, name, address, phone, email type);
int newUser(QString, QString, QString, QString, QString, QString, QString, QString);
void newAuthor(QString, QString, QString, QString, QDate, QString, QString, QString, QString);
void newClient(QString, QString, QString, QString, QString, QString, QString, QString);
void newSupplier(QString, QString, QString, QString, unsigned int, QString, QString, QString, QString);
signals:
void setUserId(long);
void returnLastError(QString);
// void returnSelQuery(QList<QStringList>);
protected:
EDBconnection();
EDBconnection( const EDBconnection& );
EDBconnection& operator=( const EDBconnection& );
private:
static EDBconnection* pinstance;
QSqlDatabase db;
QString dbHost;
QString dbName;
QString dbUser;
QString dbPass;
// QString lastError;
};
#endif // EDBCONNECTION_H