mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
bug fixed for sql parser. for issue #2105
This commit is contained in:
@@ -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();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user