diff options
| author | 2016-06-13 18:42:42 -0400 | |
|---|---|---|
| committer | 2016-06-13 18:42:42 -0400 | |
| commit | 5d9314f134ddd3dc4c853e398ac90ba247fb2e4f (patch) | |
| tree | 5c457fc188036988d7abd29a3eb09931e406510f /Plugins/SqlEnterpriseFormatter/formatselect.cpp | |
| parent | 8e640722c62692818ab840d50b3758f89a41a54e (diff) | |
Imported Upstream version 3.1.0upstream/3.1.0
Diffstat (limited to 'Plugins/SqlEnterpriseFormatter/formatselect.cpp')
| -rw-r--r-- | Plugins/SqlEnterpriseFormatter/formatselect.cpp | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/Plugins/SqlEnterpriseFormatter/formatselect.cpp b/Plugins/SqlEnterpriseFormatter/formatselect.cpp index 4d2a229..d2173c5 100644 --- a/Plugins/SqlEnterpriseFormatter/formatselect.cpp +++ b/Plugins/SqlEnterpriseFormatter/formatselect.cpp @@ -23,8 +23,14 @@ void FormatSelect::formatInternal() withNewLine().withKeyword("UNION").withNewLine(); break; case SqliteSelect::CompoundOperator::UNION_ALL: - withNewLine().withKeyword("UNION ALL").withNewLine(); + { + if (core->valuesMode) + withListComma(FormatToken::Flag::NO_NEWLINE_BEFORE); + else + withNewLine().withKeyword("UNION ALL").withNewLine(); + break; + } case SqliteSelect::CompoundOperator::INTERSECT: withNewLine().withKeyword("INTERSECT").withNewLine(); break; @@ -52,7 +58,11 @@ void FormatSelectCore::formatInternal() if (core->valuesMode) { - withKeyword("VALUES").withParDefLeft().withStatementList(core->resultColumns).withParDefRight(); + SqliteSelect* select = dynamic_cast<SqliteSelect*>(core->parentStatement()); + if (select->coreSelects.indexOf(core) == 0) // this is first core in series of cores of values mode of the SELECT + withKeyword("VALUES"); + + withParDefLeft().withStatementList(core->resultColumns).withParDefRight(); return; } |
