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

Rename Operation to BinaryOperation

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