mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
bug fixed for mysql parser. for issue #2114
This commit is contained in:
@@ -88,21 +88,41 @@ public final class ExportParameterVisitorUtils {
|
||||
if (param instanceof SQLCharExpr) {
|
||||
value = ((SQLCharExpr) param).getText();
|
||||
replace = true;
|
||||
}
|
||||
|
||||
if (param instanceof SQLBooleanExpr) {
|
||||
} else if (param instanceof SQLBooleanExpr) {
|
||||
value = ((SQLBooleanExpr) param).getBooleanValue();
|
||||
replace = true;
|
||||
}
|
||||
|
||||
if (param instanceof SQLNumericLiteralExpr) {
|
||||
} else if (param instanceof SQLNumericLiteralExpr) {
|
||||
value = ((SQLNumericLiteralExpr) param).getNumber();
|
||||
replace = true;
|
||||
}
|
||||
|
||||
if (param instanceof SQLHexExpr) {
|
||||
} else if (param instanceof SQLHexExpr) {
|
||||
value = ((SQLHexExpr) param).toBytes();
|
||||
replace = true;
|
||||
} else if (param instanceof SQLListExpr) {
|
||||
SQLListExpr list = ((SQLListExpr) param);
|
||||
|
||||
List<Object> listValues = new ArrayList<Object>();
|
||||
for (int i = 0; i < list.getItems().size(); i++) {
|
||||
SQLExpr listItem = list.getItems().get(i);
|
||||
|
||||
if (listItem instanceof SQLCharExpr) {
|
||||
Object listValue = ((SQLCharExpr) listItem).getText();
|
||||
listValues.add(listValue);
|
||||
} else if (listItem instanceof SQLBooleanExpr) {
|
||||
Object listValue = ((SQLBooleanExpr) listItem).getBooleanValue();
|
||||
listValues.add(listValue);
|
||||
} else if (listItem instanceof SQLNumericLiteralExpr) {
|
||||
Object listValue = ((SQLNumericLiteralExpr) listItem).getNumber();
|
||||
listValues.add(listValue);
|
||||
} else if (param instanceof SQLHexExpr) {
|
||||
Object listValue = ((SQLHexExpr) listItem).toBytes();
|
||||
listValues.add(listValue);
|
||||
}
|
||||
}
|
||||
|
||||
if (listValues.size() == list.getItems().size()) {
|
||||
value = listValues;
|
||||
replace = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (replace) {
|
||||
|
||||
@@ -1204,6 +1204,19 @@ public class SQLASTOutputVisitor extends SQLASTVisitorAdapter implements Paramet
|
||||
boolean allLiteral = true;
|
||||
for (SQLExpr item : targetList) {
|
||||
if (!(item instanceof SQLLiteralExpr || item instanceof SQLVariantRefExpr)) {
|
||||
if (item instanceof SQLListExpr) {
|
||||
SQLListExpr list = (SQLListExpr) item;
|
||||
for (SQLExpr listItem : list.getItems()) {
|
||||
if (!(listItem instanceof SQLLiteralExpr || listItem instanceof SQLVariantRefExpr)) {
|
||||
allLiteral = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (allLiteral) {
|
||||
break;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
allLiteral = false;
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user