aboutsummaryrefslogtreecommitdiffstats
path: root/Plugins/SqlEnterpriseFormatter/formatselect.cpp
diff options
context:
space:
mode:
authorLibravatarUnit 193 <unit193@ubuntu.com>2016-06-13 18:42:57 -0400
committerLibravatarUnit 193 <unit193@ubuntu.com>2016-06-13 18:42:57 -0400
commit65d5f68cc6dc81799c5a5d90400a2c1f0dd02547 (patch)
tree6f245ba901b87ef42fed69965aea22f5eea6b590 /Plugins/SqlEnterpriseFormatter/formatselect.cpp
parentaeb6bad01630d325a4e768e798a7a6d44e18fdaf (diff)
parent5d9314f134ddd3dc4c853e398ac90ba247fb2e4f (diff)
Merge tag 'upstream/3.1.0'
Upstream version 3.1.0 # gpg: Signature made Mon 13 Jun 2016 06:42:54 PM EDT using RSA key ID EBE9BD91 # gpg: Good signature from "Unit 193 <unit193@gmail.com>" # gpg: aka "Unit 193 <unit193@ninthfloor.org>" # gpg: aka "Unit 193 <unit193@ubuntu.com>" # gpg: aka "Unit 193 <unit193@ninthfloor.com>"
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;
}