提交 fe30ab68 authored 作者: Evgenij Ryazanov's avatar Evgenij Ryazanov

Move common parts out of conditional blocks in parseAlterTableAddColumn()

上级 920bf118
...@@ -6254,22 +6254,17 @@ public class Parser { ...@@ -6254,22 +6254,17 @@ public class Parser {
columnsToAdd.add(column); columnsToAdd.add(column);
} while (readIf(",")); } while (readIf(","));
read(")"); read(")");
if (readIf("BEFORE")) {
command.setAddBefore(readColumnIdentifier());
} else if (readIf("AFTER")) {
command.setAddAfter(readColumnIdentifier());
}
} else { } else {
boolean ifNotExists = readIfNotExists(); boolean ifNotExists = readIfNotExists();
command.setIfNotExists(ifNotExists); command.setIfNotExists(ifNotExists);
String columnName = readColumnIdentifier(); String columnName = readColumnIdentifier();
Column column = parseColumnForTable(columnName, true); Column column = parseColumnForTable(columnName, true);
columnsToAdd.add(column); columnsToAdd.add(column);
if (readIf("BEFORE")) { }
command.setAddBefore(readColumnIdentifier()); if (readIf("BEFORE")) {
} else if (readIf("AFTER")) { command.setAddBefore(readColumnIdentifier());
command.setAddAfter(readColumnIdentifier()); } else if (readIf("AFTER")) {
} command.setAddAfter(readColumnIdentifier());
} }
command.setNewColumns(columnsToAdd); command.setNewColumns(columnsToAdd);
return command; return command;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论