Skip to content

Commit 11ea9e2

Browse files
authored
2.20.04.99/lts (#2222)
* fix explain result error(2042) update mysqlVisitor class, update getItemName, add trimHelper method and removeExtraBracket method * delete Extra logic * delete MysqlVisitor.class MysqlVisitor code * update MysqlVisitor add space for left bracket
1 parent fb93fa7 commit 11ea9e2

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

copyResources.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
cp src/main/resources/* target/classes/

src/main/java/com/actiontech/dble/backend/mysql/nio/handler/builder/sqlvisitor/MysqlVisitor.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -144,25 +144,25 @@ protected String visitUnSelPushDownName(Item item, boolean canUseAlias) {
144144
protected String getItemName(Item item) {
145145
if (item instanceof ItemCondOr) {
146146
StringBuilder sb = new StringBuilder();
147+
sb.append(" ( ");
147148
for (int index = 0; index < item.getArgCount(); index++) {
148149
if (index > 0) {
149150
sb.append(" OR ");
150151
}
151-
sb.append("(");
152152
sb.append(getItemName(item.arguments().get(index)));
153-
sb.append(")");
154153
}
154+
sb.append(")");
155155
return sb.toString();
156156
} else if (item instanceof ItemCondAnd) {
157157
StringBuilder sb = new StringBuilder();
158+
sb.append(" ( ");
158159
for (int index = 0; index < item.getArgCount(); index++) {
159160
if (index > 0) {
160161
sb.append(" AND ");
161162
}
162-
sb.append("(");
163163
sb.append(getItemName(item.arguments().get(index)));
164-
sb.append(")");
165164
}
165+
sb.append(")");
166166
return sb.toString();
167167
} else if (item instanceof ItemFuncNot) {
168168
return " ( NOT " + getItemName(item.arguments().get(0)) + ")";

0 commit comments

Comments
 (0)