aboutsummaryrefslogtreecommitdiffstats
path: root/Plugins/SqlEnterpriseFormatter/formatbegintrans.cpp
blob: 5a70d61cb30b05fe09fafa0ff1d946aa3eafd02e (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 "formatbegintrans.h"
#include "parser/ast/sqlitebegintrans.h"

FormatBeginTrans::FormatBeginTrans(SqliteBeginTrans* bt) :
    bt(bt)
{
}

void FormatBeginTrans::formatInternal()
{
    withKeyword("BEGIN");

    if (bt->type != SqliteBeginTrans::Type::null)
        withKeyword(SqliteBeginTrans::typeToString(bt->type));

    if (bt->transactionKw)
    {
        withKeyword("TRANSACTION");
        if (!bt->name.isNull())
            withId(bt->name);
    }

    withConflict(bt->onConflict).withSemicolon();
}