From 7167ce41b61d2ba2cdb526777a4233eb84a3b66a Mon Sep 17 00:00:00 2001 From: Unit 193 Date: Sat, 6 Dec 2014 17:33:25 -0500 Subject: Imported Upstream version 2.99.6 --- .../SqlEnterpriseFormatter/formataltertable.cpp | 31 ++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 Plugins/SqlEnterpriseFormatter/formataltertable.cpp (limited to 'Plugins/SqlEnterpriseFormatter/formataltertable.cpp') diff --git a/Plugins/SqlEnterpriseFormatter/formataltertable.cpp b/Plugins/SqlEnterpriseFormatter/formataltertable.cpp new file mode 100644 index 0000000..d562e1b --- /dev/null +++ b/Plugins/SqlEnterpriseFormatter/formataltertable.cpp @@ -0,0 +1,31 @@ +#include "formataltertable.h" +#include "parser/ast/sqlitealtertable.h" + +FormatAlterTable::FormatAlterTable(SqliteAlterTable* alterTable) : + alterTable(alterTable) +{ +} + +void FormatAlterTable::formatInternal() +{ + withKeyword("ALTER").withKeyword("TABLE"); + + if (!alterTable->database.isNull()) + withId(alterTable->database).withIdDot(); + + withId(alterTable->table); + + if (alterTable->newColumn) + { + withKeyword("ADD"); + if (alterTable->columnKw) + withKeyword("COLUMN"); + + withStatement(alterTable->newColumn); + } + else if (!alterTable->newName.isNull()) + { + withKeyword("RENAME").withKeyword("TO").withId(alterTable->newName); + } + withSemicolon(); +} -- cgit v1.2.3