summaryrefslogtreecommitdiffstats
path: root/Plugins/SqlEnterpriseFormatter/formatcreatetable.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Plugins/SqlEnterpriseFormatter/formatcreatetable.cpp')
-rw-r--r--Plugins/SqlEnterpriseFormatter/formatcreatetable.cpp20
1 files changed, 17 insertions, 3 deletions
diff --git a/Plugins/SqlEnterpriseFormatter/formatcreatetable.cpp b/Plugins/SqlEnterpriseFormatter/formatcreatetable.cpp
index e6fd189..28020af 100644
--- a/Plugins/SqlEnterpriseFormatter/formatcreatetable.cpp
+++ b/Plugins/SqlEnterpriseFormatter/formatcreatetable.cpp
@@ -36,8 +36,22 @@ void FormatCreateTable::formatInternal()
withParDefRight();
- if (!createTable->withOutRowId.isNull())
+ markAndKeepIndent("tableOptions");
+ bool atLeastOneOption = false;
+ if (createTable->withOutRowId)
+ {
withKeyword("WITHOUT").withId("ROWID");
+ atLeastOneOption = true;
+ }
+
+ if (createTable->strict)
+ {
+ if (atLeastOneOption)
+ withListComma(FormatToken::NO_SPACE_BEFORE);
+
+ withId("STRICT");
+ //atLeastOneOption = true; // to uncomment if there are further options down below
+ }
}
withSemicolon();
@@ -206,12 +220,12 @@ void FormatCreateTableConstraint::formatInternal()
{
case SqliteCreateTable::Constraint::PRIMARY_KEY:
{
- withKeyword("PRIMARY").withKeyword("KEY").withParDefLeft().withStatementList(constr->indexedColumns).withParDefRight();
+ withKeyword("PRIMARY").withKeyword("KEY").withParDefLeft().withStatementList(constr->indexedColumns);
if (constr->autoincrKw)
withKeyword("AUTOINCREMENT");
- withConflict(constr->onConflict);
+ withParDefRight().withConflict(constr->onConflict);
break;
}
case SqliteCreateTable::Constraint::UNIQUE: