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/formataltertable.cpp | |
Imported Upstream version 2.99.6upstream/2.99.6
Diffstat (limited to 'Plugins/SqlEnterpriseFormatter/formataltertable.cpp')
| -rw-r--r-- | Plugins/SqlEnterpriseFormatter/formataltertable.cpp | 31 |
1 files changed, 31 insertions, 0 deletions
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(); +} |
