Subversion Repositories OpenInventory

Rev

Rev 135 | Go to most recent revision | 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)
29 pingvin 46
signals:
47
 
48
public slots:
49
 
50
private:
41 pingvin 51
    QString sqlDatabaseName; //     ,     
52
    QString sqlUserName; //      
53
    QString sqlPassword; //      
54
    QString sqlHostName; //    ,     
29 pingvin 55
    QSqlDatabase db;
45 pingvin 56
    QString mysqlLastError;
29 pingvin 57
 
58
protected:
59
 
60
public:
41 pingvin 61
    void setDatabaseName(QString dbname);
62
    void setUserName(QString uname);
63
    void setPassword(QString passwrd);
64
    void setHostName(QString hname);
44 pingvin 65
    bool createTable(SqlTable* table); //     
135 pingvin 66
    void close(); //    
45 pingvin 67
 
44 pingvin 68
    QString lasError();
73 pingvin 69
    QSqlError dbLastError(); //      
42 pingvin 70
 
45 pingvin 71
 
29 pingvin 72
};
73
 
74
#endif // MYSQL_H