diff options
| author | 2014-12-06 17:33:25 -0500 | |
|---|---|---|
| committer | 2014-12-06 17:33:25 -0500 | |
| commit | 7167ce41b61d2ba2cdb526777a4233eb84a3b66a (patch) | |
| tree | a35c14143716e1f2c98f808c81f89426045a946f /Plugins/SqlEnterpriseFormatter/formatwith.cpp | |
Imported Upstream version 2.99.6upstream/2.99.6
Diffstat (limited to 'Plugins/SqlEnterpriseFormatter/formatwith.cpp')
| -rw-r--r-- | Plugins/SqlEnterpriseFormatter/formatwith.cpp | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/Plugins/SqlEnterpriseFormatter/formatwith.cpp b/Plugins/SqlEnterpriseFormatter/formatwith.cpp new file mode 100644 index 0000000..d3d99d5 --- /dev/null +++ b/Plugins/SqlEnterpriseFormatter/formatwith.cpp @@ -0,0 +1,38 @@ +#include "formatwith.h" +#include "parser/ast/sqliteselect.h" + +FormatWith::FormatWith(SqliteWith *with) : + with(with) +{ +} + +void FormatWith::setLineUpKeyword(const QString& kw) +{ + lineUpKeyword = kw; +} + +void FormatWith::formatInternal() +{ + markKeywordLineUp(lineUpKeyword); + + withLinedUpKeyword("WITH"); + if (with->recursive) + withKeyword("RECURSIVE"); + + withStatementList(with->cteList); +} + + +FormatWithCommonTableExpression::FormatWithCommonTableExpression(SqliteWith::CommonTableExpression *cte) : + cte(cte) +{ +} + +void FormatWithCommonTableExpression::formatInternal() +{ + withId(cte->table); + if (cte->indexedColumns.size() > 0) + withParDefLeft().withStatementList(cte->indexedColumns, "idxCols").withParDefRight(); + + withKeyword("AS").withParDefLeft().withStatement(cte->select).withParDefRight(); +} |
