aboutsummaryrefslogtreecommitdiffstats
path: root/Plugins/SqlEnterpriseFormatter/formatselect.cpp
diff options
context:
space:
mode:
authorLibravatarUnit 193 <unit193@unit193.net>2021-12-17 07:06:30 -0500
committerLibravatarUnit 193 <unit193@unit193.net>2021-12-17 07:06:30 -0500
commit1fdc150116cad39aae5c5da407c3312b47a59e3a (patch)
tree123c79a4d7ad2d45781ba03ce939f7539fb428d8 /Plugins/SqlEnterpriseFormatter/formatselect.cpp
parentfeda8a7db8d1d7c5439aa8f8feef7cc0dd2b59a0 (diff)
New upstream version 3.3.3+dfsg1.upstream/3.3.3+dfsg1
Diffstat (limited to 'Plugins/SqlEnterpriseFormatter/formatselect.cpp')
-rw-r--r--Plugins/SqlEnterpriseFormatter/formatselect.cpp63
1 files changed, 21 insertions, 42 deletions
diff --git a/Plugins/SqlEnterpriseFormatter/formatselect.cpp b/Plugins/SqlEnterpriseFormatter/formatselect.cpp
index f5aa55e..37559eb 100644
--- a/Plugins/SqlEnterpriseFormatter/formatselect.cpp
+++ b/Plugins/SqlEnterpriseFormatter/formatselect.cpp
@@ -1,6 +1,7 @@
#include "formatselect.h"
#include "formatwith.h"
#include "parser/ast/sqlitewith.h"
+#include "parser/ast/sqlitewindowdefinition.h"
FormatSelect::FormatSelect(SqliteSelect* select) :
select(select)
@@ -86,6 +87,13 @@ void FormatSelectCore::formatInternal()
if (core->having)
withNewLine().withLinedUpKeyword("HAVING", "selectCore").withStatement(core->having, "having");
+ if (core->windows.size() > 0)
+ {
+ withNewLine().withLinedUpKeyword("WINDOW", "selectCore");
+ markKeywordLineUp("WINDOW", "selectWindow");
+ withStatementList(core->windows, "selectWindow");
+ }
+
if (core->orderBy.size() > 0)
withNewLine().withLinedUpKeyword("ORDER", "selectCore").withKeyword("BY").withStatementList(core->orderBy, "order");
@@ -197,50 +205,21 @@ void FormatSelectCoreJoinOp::formatInternal()
withNewLine();
QStringList keywords;
- switch (dialect)
- {
- case Dialect::Sqlite3:
- {
- if (joinOp->naturalKw)
- keywords << "NATURAL";
+ if (joinOp->naturalKw)
+ keywords << "NATURAL";
- if (joinOp->leftKw)
- {
- keywords << "LEFT";
- if (joinOp->outerKw)
- keywords << "OUTER";
- }
- else if (joinOp->innerKw)
- keywords << "INNER";
- else if (joinOp->crossKw)
- keywords << "CROSS";
-
- keywords << "JOIN";
- break;
- }
- case Dialect::Sqlite2:
- {
- if (joinOp->naturalKw)
- keywords << "NATURAL";
-
- if (joinOp->leftKw)
- keywords << "LEFT";
- else if (joinOp->rightKw)
- keywords << "RIGHT";
- else if (joinOp->fullKw)
- keywords << "FULL";
-
- if (joinOp->innerKw)
- keywords << "INNER";
- else if (joinOp->crossKw)
- keywords << "CROSS";
- else if (joinOp->outerKw)
- keywords << "OUTER";
-
- keywords << "JOIN";
- break;
- }
+ if (joinOp->leftKw)
+ {
+ keywords << "LEFT";
+ if (joinOp->outerKw)
+ keywords << "OUTER";
}
+ else if (joinOp->innerKw)
+ keywords << "INNER";
+ else if (joinOp->crossKw)
+ keywords << "CROSS";
+
+ keywords << "JOIN";
if (keywords.size() == 0)
return;