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

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

void FormatCopy::formatInternal()
{
    handleExplainQuery(copy);
    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();
}