提交 0cd1c2ed authored 作者: Evgenij Ryazanov's avatar Evgenij Ryazanov

Rename Operation to BinaryOperation

上级 60dd9ea4
......@@ -148,6 +148,8 @@ import org.h2.engine.UserDataType;
import org.h2.expression.Aggregate;
import org.h2.expression.Aggregate.AggregateType;
import org.h2.expression.Alias;
import org.h2.expression.BinaryOperation;
import org.h2.expression.BinaryOperation.OpType;
import org.h2.expression.CompareLike;
import org.h2.expression.Comparison;
import org.h2.expression.ConditionAndOr;
......@@ -163,8 +165,6 @@ import org.h2.expression.Function;
import org.h2.expression.FunctionCall;
import org.h2.expression.JavaAggregate;
import org.h2.expression.JavaFunction;
import org.h2.expression.Operation;
import org.h2.expression.Operation.OpType;
import org.h2.expression.Parameter;
import org.h2.expression.Rownum;
import org.h2.expression.SequenceValue;
......@@ -2856,7 +2856,7 @@ public class Parser {
Expression r = readSum();
while (true) {
if (readIf(STRING_CONCAT)) {
r = new Operation(OpType.CONCAT, r, readSum());
r = new BinaryOperation(OpType.CONCAT, r, readSum());
} else if (readIf(TILDE)) {
if (readIf(ASTERISK)) {
Function function = Function.getFunction(database, "CAST");
......@@ -2886,9 +2886,9 @@ public class Parser {
Expression r = readFactor();
while (true) {
if (readIf(PLUS_SIGN)) {
r = new Operation(OpType.PLUS, r, readFactor());
r = new BinaryOperation(OpType.PLUS, r, readFactor());
} else if (readIf(MINUS_SIGN)) {
r = new Operation(OpType.MINUS, r, readFactor());
r = new BinaryOperation(OpType.MINUS, r, readFactor());
} else {
return r;
}
......@@ -2899,11 +2899,11 @@ public class Parser {
Expression r = readTerm();
while (true) {
if (readIf(ASTERISK)) {
r = new Operation(OpType.MULTIPLY, r, readTerm());
r = new BinaryOperation(OpType.MULTIPLY, r, readTerm());
} else if (readIf(SLASH)) {
r = new Operation(OpType.DIVIDE, r, readTerm());
r = new BinaryOperation(OpType.DIVIDE, r, readTerm());
} else if (readIf(PERCENT)) {
r = new Operation(OpType.MODULUS, r, readTerm());
r = new BinaryOperation(OpType.MODULUS, r, readTerm());
} else {
return r;
}
......@@ -3608,7 +3608,7 @@ public class Parser {
Function function = Function.getFunction(database, "ARRAY_GET");
function.setParameter(0, r);
r = readExpression();
r = new Operation(OpType.PLUS, r, ValueExpression.get(ValueInt
r = new BinaryOperation(OpType.PLUS, r, ValueExpression.get(ValueInt
.get(1)));
function.setParameter(1, r);
r = function;
......
......@@ -21,7 +21,7 @@ import org.h2.value.ValueString;
/**
* A mathematical expression, or string concatenation.
*/
public class Operation extends Expression {
public class BinaryOperation extends Expression {
public enum OpType {
/**
......@@ -61,7 +61,7 @@ public class Operation extends Expression {
private int dataType;
private boolean convertRight = true;
public Operation(OpType opType, Expression left, Expression right) {
public BinaryOperation(OpType opType, Expression left, Expression right) {
this.opType = opType;
this.left = left;
this.right = right;
......@@ -298,7 +298,7 @@ public class Operation extends Expression {
// Oracle date add
Function f = Function.getFunction(session.getDatabase(), "DATEADD");
f.setParameter(0, ValueExpression.get(ValueString.get("SECOND")));
left = new Operation(OpType.MULTIPLY, ValueExpression.get(ValueInt
left = new BinaryOperation(OpType.MULTIPLY, ValueExpression.get(ValueInt
.get(60 * 60 * 24)), left);
f.setParameter(1, left);
f.setParameter(2, right);
......@@ -338,7 +338,7 @@ public class Operation extends Expression {
// Oracle date subtract
Function f = Function.getFunction(session.getDatabase(), "DATEADD");
f.setParameter(0, ValueExpression.get(ValueString.get("SECOND")));
right = new Operation(OpType.MULTIPLY, ValueExpression.get(ValueInt
right = new BinaryOperation(OpType.MULTIPLY, ValueExpression.get(ValueInt
.get(60 * 60 * 24)), right);
right = new UnaryOperation(right);
right = right.optimize(session);
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论