mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
add setParent
This commit is contained in:
@@ -41,8 +41,8 @@ public class SQLBinaryOpExpr extends SQLExprImpl implements Serializable {
|
||||
|
||||
public SQLBinaryOpExpr(SQLExpr left, SQLExpr right, SQLBinaryOperator operator){
|
||||
|
||||
this.left = left;
|
||||
this.right = right;
|
||||
setLeft(left);
|
||||
setRight(right);
|
||||
this.operator = operator;
|
||||
}
|
||||
|
||||
|
||||
@@ -63,6 +63,9 @@ public class SQLCaseExpr extends SQLExprImpl implements Serializable {
|
||||
}
|
||||
|
||||
public void setValueExpr(SQLExpr valueExpr) {
|
||||
if (valueExpr != null) {
|
||||
valueExpr.setParent(this);
|
||||
}
|
||||
this.valueExpr = valueExpr;
|
||||
}
|
||||
|
||||
@@ -71,6 +74,9 @@ public class SQLCaseExpr extends SQLExprImpl implements Serializable {
|
||||
}
|
||||
|
||||
public void setElseExpr(SQLExpr elseExpr) {
|
||||
if (elseExpr != null) {
|
||||
elseExpr.setParent(this);
|
||||
}
|
||||
this.elseExpr = elseExpr;
|
||||
}
|
||||
|
||||
@@ -78,6 +84,13 @@ public class SQLCaseExpr extends SQLExprImpl implements Serializable {
|
||||
return this.items;
|
||||
}
|
||||
|
||||
public void addItem(Item item) {
|
||||
if (item != null) {
|
||||
item.setParent(this);
|
||||
this.items.add(item);
|
||||
}
|
||||
}
|
||||
|
||||
protected void accept0(SQLASTVisitor visitor) {
|
||||
if (visitor.visit(this)) {
|
||||
acceptChild(visitor, this.valueExpr);
|
||||
@@ -99,8 +112,8 @@ public class SQLCaseExpr extends SQLExprImpl implements Serializable {
|
||||
|
||||
public Item(SQLExpr conditionExpr, SQLExpr valueExpr){
|
||||
|
||||
this.conditionExpr = conditionExpr;
|
||||
this.valueExpr = valueExpr;
|
||||
setConditionExpr(conditionExpr);
|
||||
setValueExpr(valueExpr);
|
||||
}
|
||||
|
||||
public SQLExpr getConditionExpr() {
|
||||
@@ -108,6 +121,9 @@ public class SQLCaseExpr extends SQLExprImpl implements Serializable {
|
||||
}
|
||||
|
||||
public void setConditionExpr(SQLExpr conditionExpr) {
|
||||
if (conditionExpr != null) {
|
||||
conditionExpr.setParent(this);
|
||||
}
|
||||
this.conditionExpr = conditionExpr;
|
||||
}
|
||||
|
||||
@@ -116,6 +132,9 @@ public class SQLCaseExpr extends SQLExprImpl implements Serializable {
|
||||
}
|
||||
|
||||
public void setValueExpr(SQLExpr valueExpr) {
|
||||
if (valueExpr != null) {
|
||||
valueExpr.setParent(this);
|
||||
}
|
||||
this.valueExpr = valueExpr;
|
||||
}
|
||||
|
||||
|
||||
@@ -241,7 +241,7 @@ public class SQLExprParser extends SQLParser {
|
||||
accept(Token.THEN);
|
||||
SQLExpr valueExpr = expr();
|
||||
SQLCaseExpr.Item caseItem = new SQLCaseExpr.Item(testExpr, valueExpr);
|
||||
caseExpr.getItems().add(caseItem);
|
||||
caseExpr.addItem(caseItem);
|
||||
|
||||
while (lexer.token() == Token.WHEN) {
|
||||
lexer.nextToken();
|
||||
|
||||
@@ -38,7 +38,7 @@ public class Isnull implements Function {
|
||||
SQLExpr condition = parameters.get(0);
|
||||
condition.accept(visitor);
|
||||
Object itemValue = condition.getAttributes().get(EVAL_VALUE);
|
||||
if (itemValue == null || itemValue == EVAL_VALUE_NULL) {
|
||||
if (itemValue == EVAL_VALUE_NULL) {
|
||||
return Boolean.TRUE;
|
||||
} else {
|
||||
return Boolean.FALSE;
|
||||
|
||||
Reference in New Issue
Block a user