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

Fix NPE in error message generation and reuse method

上级 21b3ef34
...@@ -305,15 +305,7 @@ public class Insert extends Prepared implements ResultTarget { ...@@ -305,15 +305,7 @@ public class Insert extends Prepared implements ResultTarget {
buff.append(",\n"); buff.append(",\n");
} }
buff.append('('); buff.append('(');
buff.resetCount(); Expression.writeExpressions(buff.builder(), expr);
for (Expression e : expr) {
buff.appendExceptFirst(", ");
if (e == null) {
buff.append("DEFAULT");
} else {
e.getSQL(buff.builder());
}
}
buff.append(')'); buff.append(')');
} }
} else { } else {
......
...@@ -242,15 +242,7 @@ public class Merge extends Prepared { ...@@ -242,15 +242,7 @@ public class Merge extends Prepared {
buff.append(", "); buff.append(", ");
} }
buff.append('('); buff.append('(');
buff.resetCount(); Expression.writeExpressions(buff.builder(), expr);
for (Expression e : expr) {
buff.appendExceptFirst(", ");
if (e == null) {
buff.append("DEFAULT");
} else {
e.getSQL(buff.builder());
}
}
buff.append(')'); buff.append(')');
} }
} else { } else {
......
...@@ -222,15 +222,7 @@ public class Replace extends Prepared { ...@@ -222,15 +222,7 @@ public class Replace extends Prepared {
buff.append(", "); buff.append(", ");
} }
buff.append('('); buff.append('(');
buff.resetCount(); Expression.writeExpressions(buff.builder(), expr);
for (Expression e : expr) {
buff.appendExceptFirst(", ");
if (e == null) {
buff.append("DEFAULT");
} else {
e.getSQL(buff.builder());
}
}
buff.append(')'); buff.append(')');
} }
} else { } else {
......
...@@ -54,7 +54,12 @@ public abstract class Expression { ...@@ -54,7 +54,12 @@ public abstract class Expression {
if (i > 0) { if (i > 0) {
builder.append(", "); builder.append(", ");
} }
expressions[i].getSQL(builder); Expression e = expressions[i];
if (e == null) {
builder.append("DEFAULT");
} else {
e.getSQL(builder);
}
} }
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论