aboutsummaryrefslogtreecommitdiffstats
path: root/Plugins/SqlEnterpriseFormatter/formatselect.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Plugins/SqlEnterpriseFormatter/formatselect.cpp')
-rw-r--r--Plugins/SqlEnterpriseFormatter/formatselect.cpp14
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;
}