aboutsummaryrefslogtreecommitdiffstats
path: root/Plugins/SqlEnterpriseFormatter/formatcopy.cpp
blob: fa07d483f141ae3c1cda5ed46b147c8a19e86cb9 (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
#include "formatcopy.h"
#include "parser/ast/sqlitecopy.h"

FormatCopy::FormatCopy(SqliteCopy* copy) :
    copy(copy)
{
}

void FormatCopy::formatInternal()
{
    withKeyword("COPY");
    if (copy->onConflict != SqliteConflictAlgo::null)
        withKeyword("OR").withKeyword(sqliteConflictAlgo(copy->onConflict));

    if (!copy->database.isNull())
        withId(copy->database);

    withId(copy->table).withKeyword("FROM").withString(copy->file);

    if (!copy->delimiter.isNull())
        withKeyword("USING").withKeyword("DELIMITERS").withString(copy->delimiter);

    withSemicolon();
}