aboutsummaryrefslogtreecommitdiffstats
path: root/Plugins/SqlEnterpriseFormatter/formatpragma.cpp
blob: 0b6491a6c514fa8ca5df7b9cc2ff42452ef8d10c (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 "formatpragma.h"
#include "parser/ast/sqlitepragma.h"

FormatPragma::FormatPragma(SqlitePragma* pragma) :
    pragma(pragma)
{
}

void FormatPragma::formatInternal()
{
    withKeyword("PRAGMA");

    if (!pragma->database.isNull())
        withId(pragma->database).withIdDot();

    withId(pragma->pragmaName);

    if (pragma->equalsOp)
        withOperator("=").withLiteral(pragma->value);
    else if (pragma->parenthesis)
        withParExprLeft().withLiteral(pragma->value).withParExprRight();

    withSemicolon();
}