aboutsummaryrefslogtreecommitdiffstats
path: root/SQLiteStudio3/guiSQLiteStudio/constraints/constraintcheckpanel.h
blob: 50988803273accd7587a3f8cfeb0f12df90005f1 (plain) (blame)
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
#ifndef CONSTRAINTCHECKPANEL_H
#define CONSTRAINTCHECKPANEL_H

#include "constraintpanel.h"
#include "parser/ast/sqliteconflictalgo.h"
#include "guiSQLiteStudio_global.h"
#include <QWidget>

namespace Ui {
    class ConstraintCheckPanel;
}

class GUI_API_EXPORT ConstraintCheckPanel : public ConstraintPanel
{
        Q_OBJECT

    public:
        explicit ConstraintCheckPanel(QWidget *parent = 0);
        ~ConstraintCheckPanel();

        bool validate();
        bool validateOnly();

    protected:
        void changeEvent(QEvent *e);
        void constraintAvailable();
        void storeConfiguration();
        virtual SqliteExpr* readExpr() = 0;
        virtual QString readName() = 0;
        virtual void storeType() = 0;
        virtual SqliteConflictAlgo readConflictAlgo() = 0;
        virtual void storeExpr(SqliteExpr* expr) = 0;
        virtual void storeName(const QString& name) = 0;
        virtual void storeConflictAlgo(SqliteConflictAlgo algo) = 0;
        virtual SqliteCreateTable* getCreateTable() = 0;

    private:
        void init();
        void readConstraint();
        void updateVirtualSql();
        SqliteExprPtr parseExpression(const QString& sql);

        Ui::ConstraintCheckPanel *ui = nullptr;

    private slots:
        void updateState();
};

#endif // CONSTRAINTCHECKPANEL_H