bug fixed for sql parser. for issue #2105

This commit is contained in:
wenshao
2017-11-13 14:02:02 +08:00
parent 9f4bd3fc68
commit 97933dd516
2 changed files with 46 additions and 3 deletions
@@ -87,11 +87,27 @@ public class ParameterizedOutputVisitorUtils {
}
for (int i = 0; i < statementList.size(); i++) {
if (i > 0) {
out.append(";\n");
}
SQLStatement stmt = statementList.get(i);
if (i > 0) {
SQLStatement preStmt = statementList.get(i - 1);
if (preStmt.getClass() == stmt.getClass()) {
StringBuilder buf = new StringBuilder();
ParameterizedVisitor v1 = createParameterizedOutputVisitor(buf, dbType);
preStmt.accept(v1);
if (out.toString().equals(buf.toString())) {
continue;
}
}
if (!preStmt.isAfterSemi()) {
out.append(";\n");
} else {
out.append('\n');
}
}
if (stmt.hasBeforeComment()) {
stmt.getBeforeCommentsDirect().clear();
}