From 1fdc150116cad39aae5c5da407c3312b47a59e3a Mon Sep 17 00:00:00 2001 From: Unit 193 Date: Fri, 17 Dec 2021 07:06:30 -0500 Subject: New upstream version 3.3.3+dfsg1. --- Plugins/SqlEnterpriseFormatter/formatcreatetable.cpp | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) (limited to 'Plugins/SqlEnterpriseFormatter/formatcreatetable.cpp') diff --git a/Plugins/SqlEnterpriseFormatter/formatcreatetable.cpp b/Plugins/SqlEnterpriseFormatter/formatcreatetable.cpp index 6ac6226..e6fd189 100644 --- a/Plugins/SqlEnterpriseFormatter/formatcreatetable.cpp +++ b/Plugins/SqlEnterpriseFormatter/formatcreatetable.cpp @@ -20,7 +20,7 @@ void FormatCreateTable::formatInternal() if (createTable->ifNotExistsKw) withKeyword("IF").withKeyword("NOT").withKeyword("EXISTS"); - if (dialect == Dialect::Sqlite3 && !createTable->database.isNull()) + if (!createTable->database.isNull()) withId(createTable->database).withIdDot(); withId(createTable->table); @@ -81,9 +81,9 @@ void FormatCreateTable::formatColumns(const QList& c int FormatCreateTable::getColNameLength(const QString& name) { if (cfg->SqlEnterpriseFormatter.AlwaysUseNameWrapping.get()) - return wrapObjName(name, dialect, wrapper).length(); + return wrapObjName(name, wrapper).length(); else - return wrapObjIfNeeded(name, dialect, wrapper).length(); + return wrapObjIfNeeded(name, wrapper).length(); } FormatCreateTableColumn::FormatCreateTableColumn(SqliteCreateTable::Column* column) : @@ -173,6 +173,17 @@ void FormatCreateTableColumnConstraint::formatInternal() withStatement(constr->foreignKey); break; } + case SqliteCreateTable::Column::Constraint::GENERATED: + { + if (constr->generatedKw) + withKeyword("GENERATED").withKeyword("ALWAYS"); + + withKeyword("AS").withParExprLeft().withStatement(constr->expr).withParExprRight(); + if (constr->generatedType != SqliteCreateTable::Column::Constraint::GeneratedType::null) + withId(SqliteCreateTable::Column::Constraint::toString(constr->generatedType), false); + + break; + } case SqliteCreateTable::Column::Constraint::NULL_: case SqliteCreateTable::Column::Constraint::NAME_ONLY: case SqliteCreateTable::Column::Constraint::DEFERRABLE_ONLY: -- cgit v1.2.3