未验证 提交 d7272e52 编写于 作者: S Serge Rider 提交者: GitHub

Merge pull request #8547 from kai-morich/case-when-indent

fix CASE ... WHEN ... END indent
......@@ -107,7 +107,7 @@ class IndentFormatter {
result += insertReturnAndIndent(argList, index + 1, indent);
} else if (SQLUtils.isBlockEndKeyword(dialect, tokenString)) {
indent--;
result += insertReturnAndIndent(argList, index, indent - 1);
result += insertReturnAndIndent(argList, index, indent);
} else switch (tokenString) {
case "CREATE":
if (!isCompact) {
......@@ -147,12 +147,18 @@ class IndentFormatter {
case "CASE": //$NON-NLS-1$
if (!isCompact) {
result += insertReturnAndIndent(argList, index - 1, indent);
if (!"WHEN".equals(getNextKeyword(argList, index))) {
if ("WHEN".equalsIgnoreCase(getNextKeyword(argList, index))) {
indent++;
result += insertReturnAndIndent(argList, index + 1, indent);
}
}
break;
case "END": // CASE ... END
if (!isCompact) {
indent--;
result += insertReturnAndIndent(argList, index, indent);
}
break;
case "FROM":
case "WHERE":
case "START WITH":
......@@ -189,7 +195,7 @@ class IndentFormatter {
break;
}
case "WHEN":
if ("CASE".equals(getPrevKeyword(argList, index))) {
if ("CASE".equalsIgnoreCase(getPrevKeyword(argList, index))) {
break;
}
case "ELSE": //$NON-NLS-1$
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册