blob: 62dd84d01549fc78ac2a42e0d496fc77954ecf7f (
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
|
#ifndef SQLITEFOREIGNKEY_H
#define SQLITEFOREIGNKEY_H
#include "sqlitestatement.h"
#include "sqliteindexedcolumn.h"
#include "sqlitedeferrable.h"
#include "parser/statementtokenbuilder.h"
#include <QList>
#include <QString>
class API_EXPORT SqliteForeignKey : public SqliteStatement
{
public:
class API_EXPORT Condition : public SqliteStatement
{
public:
enum Action
{
UPDATE,
INSERT,
DELETE,
MATCH
};
enum Reaction
{
SET_NULL,
SET_DEFAULT,
CASCADE,
RESTRICT,
NO_ACTION
};
Condition(Action action, Reaction reaction);
explicit Condition(const QString& name);
Condition(const Condition& other);
static QString toString(Reaction reaction);
static Reaction toEnum(const QString& reaction);
SqliteStatement* clone();
Action action;
QString name = QString();
Reaction reaction = NO_ACTION;
protected:
TokenList rebuildTokensFromContents();
private:
void applyReactionToBuilder(StatementTokenBuilder& builder);
};
SqliteForeignKey();
SqliteForeignKey(const SqliteForeignKey& other);
~SqliteForeignKey();
SqliteStatement* clone();
QString foreignTable = QString();
QList<SqliteIndexedColumn*> indexedColumns;
QList<Condition*> conditions;
SqliteDeferrable deferrable = SqliteDeferrable::null; // Those two are for table constraint only,
SqliteInitially initially = SqliteInitially::null; // because column has its own fields for that.
protected:
QStringList getTablesInStatement();
TokenList getTableTokensInStatement();
QList<FullObject> getFullObjectsInStatement();
TokenList rebuildTokensFromContents();
};
typedef QSharedPointer<SqliteForeignKey> SqliteForeignKeyPtr;
#endif // SQLITEFOREIGNKEY_H
|