aboutsummaryrefslogtreecommitdiffstats
path: root/Plugins/SqlEnterpriseFormatter/formatattach.cpp
blob: e969495618b0ea4b3441d8b1eff2f9cef43420c9 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#include "formatattach.h"
#include "parser/ast/sqliteattach.h"
#include "parser/ast/sqliteexpr.h"

FormatAttach::FormatAttach(SqliteAttach* att) :
    att(att)
{
}

void FormatAttach::formatInternal()
{
    withKeyword("ATTACH");

    if (att->databaseKw)
        withKeyword("DATABASE");

    withStatement(att->databaseUrl).withKeyword("AS").withStatement(att->name);
    if (att->key)
        withKeyword("KEY").withStatement(att->key);

    withSemicolon();
}