Subversion Repositories OpenInventory

Rev

Rev 143 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
29 pingvin 1
/************************************************************************************
2
**  MySQL       
3
** MySQL class contains methods for working with databases
4
**
5
**
6
*************************************************************************************/
7
 
8
 
9
 
10
 
11
 
12
 
13
#ifndef MYSQL_H
14
#define MYSQL_H
15
 
38 pingvin 16
#include "settingsdialog.h"
17
#include "tablefield.h"
18
#include "sqltable.h"
19
 
29 pingvin 20
#include <QObject>
21
#include <QtGui>
22
#include <QMainWindow>
23
#include <QString>
24
#include <QtSql>
25
#include <QSqlTableModel>
26
#include <QTableView>
27
#include <QSqlDriverPlugin>
28
#include <QIcon>
29
#include <QVariant>
30
#include <QProcess>
31
#include <QByteArray>
73 pingvin 32
#include <QSqlQuery>
29 pingvin 33
 
34
 
35
class MySql : public QObject
36
{
37
Q_OBJECT
38
public:
39
    explicit MySql(QObject *parent = 0);
96 pingvin 40
 ~MySql();
44 pingvin 41
    bool connect(); //    
45 pingvin 42
    bool createDataBase(); //             ( ListOfClasses   DescriptionOfClasses)
56 pingvin 43
    bool createListOfClassesTable(); //            ( ListOfClasses)
44
    bool createDescriptionOfClassesTable(); //           ( DescriptionOfClasses)
143 pingvin 45
    bool createListModelsTable(); //          ( ListOfModels)
210 pingvin 46
    bool createFiltersTable(); //          ( Filters)
29 pingvin 47
signals:
48
 
49
public slots:
50
 
51
private:
41 pingvin 52
    QString sqlDatabaseName; //     ,     
53
    QString sqlUserName; //      
54
    QString sqlPassword; //      
55
    QString sqlHostName; //    ,     
29 pingvin 56
    QSqlDatabase db;
45 pingvin 57
    QString mysqlLastError;
29 pingvin 58
 
59
protected:
60
 
61
public:
41 pingvin 62
    void setDatabaseName(QString dbname);
63
    void setUserName(QString uname);
64
    void setPassword(QString passwrd);
65
    void setHostName(QString hname);
44 pingvin 66
    bool createTable(SqlTable* table); //     
135 pingvin 67
    void close(); //    
45 pingvin 68
 
44 pingvin 69
    QString lasError();
73 pingvin 70
    QSqlError dbLastError(); //      
42 pingvin 71
 
45 pingvin 72
 
29 pingvin 73
};
74
 
75
#endif // MYSQL_H