aboutsummaryrefslogtreecommitdiffstats
path: root/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqliteupdate.h
blob: be121b206cf3dd9d9dffb460632dce808df54adb (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
#ifndef SQLITEUPDATE_H
#define SQLITEUPDATE_H

#include "sqlitequery.h"
#include "sqliteconflictalgo.h"
#include "sqliteselect.h"

#include <QStringList>
#include <QMap>

class SqliteExpr;
class SqliteWith;

class API_EXPORT SqliteUpdate : public SqliteQuery
{
    public:
        typedef QPair<QVariant,SqliteExpr*> ColumnAndValue;

        SqliteUpdate();
        SqliteUpdate(const SqliteUpdate& other);
        ~SqliteUpdate();
        SqliteUpdate(SqliteConflictAlgo onConflict, const QString& name1, const QString& name2,
                     bool notIndexedKw, const QString& indexedBy, const QList<ColumnAndValue>& values,
                     SqliteSelect::Core::JoinSource* from, SqliteExpr* where, SqliteWith* with, const QList<SqliteResultColumn*>& returning);

        SqliteStatement* clone();
        SqliteExpr* getValueForColumnSet(const QString& column);

        SqliteConflictAlgo onConflict = SqliteConflictAlgo::null;
        QString database = QString();
        QString table = QString();
        bool indexedByKw = false;
        bool notIndexedKw = false;
        QString indexedBy = QString();
        QList<ColumnAndValue> keyValueMap;
        SqliteSelect::Core::JoinSource* from = nullptr;
        SqliteExpr* where = nullptr;
        SqliteWith* with = nullptr;
        QList<SqliteResultColumn*> returning;

    protected:
        QStringList getColumnsInStatement();
        QStringList getTablesInStatement();
        QStringList getDatabasesInStatement();
        TokenList getColumnTokensInStatement();
        TokenList getTableTokensInStatement();
        TokenList getDatabaseTokensInStatement();
        QList<FullObject> getFullObjectsInStatement();
        TokenList rebuildTokensFromContents();
};

typedef QSharedPointer<SqliteUpdate> SqliteUpdatePtr;

#endif // SQLITEUPDATE_H