summaryrefslogtreecommitdiffstats
path: root/Plugins/SqlEnterpriseFormatter/formatattach.cpp
blob: 8ba3f3e7b6bde3694a8db3f381386372b15792ee (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
#include "formatattach.h"
#include "parser/ast/sqliteattach.h"
#include "parser/ast/sqliteexpr.h"

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

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

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

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

    withSemicolon();
}