mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
修正SQL合并超长条件时的bug
This commit is contained in:
+14
-3
@@ -42,7 +42,7 @@ public class MySqlParameterizedOutputVisitor extends MySqlOutputVisitor {
|
||||
|
||||
return super.visit(x);
|
||||
}
|
||||
|
||||
|
||||
public boolean visit(SQLNullExpr x) {
|
||||
print('?');
|
||||
return false;
|
||||
@@ -65,8 +65,19 @@ public class MySqlParameterizedOutputVisitor extends MySqlOutputVisitor {
|
||||
x = new SQLBinaryOpExpr(new SQLVariantRefExpr("?"), x.getOperator(), x.getRight());
|
||||
}
|
||||
|
||||
if (x.getRight() instanceof SQLBinaryOpExpr) {
|
||||
x = new SQLBinaryOpExpr(x.getLeft(), x.getOperator(), merge((SQLBinaryOpExpr) x.getRight()));
|
||||
for (;;) {
|
||||
if (x.getRight() instanceof SQLBinaryOpExpr) {
|
||||
if (x.getLeft() instanceof SQLBinaryOpExpr) {
|
||||
SQLBinaryOpExpr leftBinaryExpr = (SQLBinaryOpExpr) x.getLeft();
|
||||
if (leftBinaryExpr.getRight().equals(x.getRight())) {
|
||||
x = leftBinaryExpr;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
x = new SQLBinaryOpExpr(x.getLeft(), x.getOperator(), merge((SQLBinaryOpExpr) x.getRight()));
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
if (x.getLeft() instanceof SQLBinaryOpExpr) {
|
||||
|
||||
+13
-2
@@ -64,8 +64,19 @@ public class OracleParameterizedOutputVisitor extends OracleOutputVisitor {
|
||||
x = new SQLBinaryOpExpr(new SQLVariantRefExpr("?"), x.getOperator(), x.getRight());
|
||||
}
|
||||
|
||||
if (x.getRight() instanceof SQLBinaryOpExpr) {
|
||||
x = new SQLBinaryOpExpr(x.getLeft(), x.getOperator(), merge((SQLBinaryOpExpr) x.getRight()));
|
||||
for (;;) {
|
||||
if (x.getRight() instanceof SQLBinaryOpExpr) {
|
||||
if (x.getLeft() instanceof SQLBinaryOpExpr) {
|
||||
SQLBinaryOpExpr leftBinaryExpr = (SQLBinaryOpExpr) x.getLeft();
|
||||
if (leftBinaryExpr.getRight().equals(x.getRight())) {
|
||||
x = leftBinaryExpr;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
x = new SQLBinaryOpExpr(x.getLeft(), x.getOperator(), merge((SQLBinaryOpExpr) x.getRight()));
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
if (x.getLeft() instanceof SQLBinaryOpExpr) {
|
||||
|
||||
Reference in New Issue
Block a user