aboutsummaryrefslogtreecommitdiffstats
path: root/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqliteupsert.h
blob: 4a245cdd8e2c8f1557ff43e3e3a2de381046ff4a (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
#ifndef SQLITEUPSERT_H
#define SQLITEUPSERT_H


#include "sqlitestatement.h"
#include "sqliteindexedcolumn.h"

class SqliteExpr;
class SqliteOrderBy;

class SqliteUpsert : public SqliteStatement
{
    public:
        typedef QPair<QVariant,SqliteExpr*> ColumnAndValue;

        SqliteUpsert();
        SqliteUpsert(const QList<SqliteOrderBy*>& conflictColumns, SqliteExpr* conflictWhere);
        SqliteUpsert(const QList<SqliteOrderBy*>& conflictColumns, SqliteExpr* conflictWhere, const QList<ColumnAndValue>& values, SqliteExpr* setWhere);
        SqliteUpsert(const SqliteUpsert& other);

        SqliteStatement* clone();

        QList<SqliteOrderBy*> conflictColumns;
        SqliteExpr* conflictWhere = nullptr;
        QList<ColumnAndValue> keyValueMap;
        SqliteExpr* setWhere = nullptr;
        bool doNothing = false;

    protected:
        TokenList rebuildTokensFromContents();
        QStringList getColumnsInStatement();
        TokenList getColumnTokensInStatement();
};

#endif // SQLITEUPSERT_H