Top Description Inners Fields Constructors Methods
org.h2.expression

public Class BinaryOperation

extends Operation2
Class Inheritance
Imports
org.h2.engine.Constants, .SessionLocal, org.h2.expression.IntervalOperation.IntervalOpType, org.h2.expression.function.DateTimeFunction, org.h2.message.DbException, org.h2.value.DataType, .TypeInfo, .Value, .ValueInteger, .ValueNull, .ValueNumeric

A mathematical expression, or string concatenation.

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static enum

Field Summary

Modifier and TypeField and Description
private boolean
private TypeInfo
private BinaryOperation.OpType
Inherited from org.h2.expression.Operation2:
leftrighttype

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
private String
public BinaryOperation.OpType

Returns:

the type of this binary operation
getOperationType
()

Returns the type of this binary operation.

public StringBuilder
getUnenclosedSQL(StringBuilder
string builder
builder
,
int
formatting flags
sqlFlags
)

Implements abstract org.h2.expression.Expression.getUnenclosedSQL.

Get the SQL statement of this expression.

private DbException
private DbException
getUnsupported(int l, int r)

public Value
getValue(SessionLocal
the session
session
)

Implements abstract org.h2.expression.Expression.getValue.

Return the resulting value for the current row.

public boolean
needParentheses()

Overrides org.h2.expression.Expression.needParentheses.

Returns whether this expressions needs to be wrapped in parentheses when it is used as an argument of other expressions.

public Expression
optimize(SessionLocal
the session
session
)

Implements abstract org.h2.expression.Expression.optimize.

Try to optimize the expression.

private Expression
optimizeDateTime(SessionLocal session, int l, int r)

private void
optimizeDecfloat(TypeInfo leftType, TypeInfo rightType)

private Expression
optimizeInterval(int l, int r)

private void
optimizeNumeric(TypeInfo leftType, TypeInfo rightType)

public void
setForcedType(TypeInfo
the forced data type
forcedType
)

Sets a forced data type of a datetime minus datetime operation.

private void
swap()

Inherited from org.h2.expression.Operation2:
getCostgetSubexpressiongetSubexpressionCountgetTypeisEverythingmapColumnssetEvaluatableupdateAggregate

Field Detail

convertRightback to summary
private boolean convertRight
forcedTypeback to summary
private TypeInfo forcedType
opTypeback to summary
private BinaryOperation.OpType opType

Constructor Detail

BinaryOperationback to summary
public BinaryOperation(BinaryOperation.OpType opType, Expression left, Expression right)

Method Detail

getOperationTokenback to summary
private String getOperationToken()
getOperationTypeback to summary
public BinaryOperation.OpType getOperationType()

Returns the type of this binary operation.

Returns:BinaryOperation.OpType

the type of this binary operation

getUnenclosedSQLback to summary
public StringBuilder getUnenclosedSQL(StringBuilder builder, int sqlFlags)

Implements abstract org.h2.expression.Expression.getUnenclosedSQL.

Doc from org.h2.expression.Expression.getUnenclosedSQL.

Get the SQL statement of this expression. This may not always be the original SQL statement, especially after optimization. Enclosing '(' and ')' are never appended.

Parameters
builder:StringBuilder

string builder

sqlFlags:int

formatting flags

Returns:StringBuilder

the specified string builder

Annotations
@Override
getUnexpectedForcedTypeExceptionback to summary
private DbException getUnexpectedForcedTypeException()
getUnsupportedback to summary
private DbException getUnsupported(int l, int r)
getValueback to summary
public Value getValue(SessionLocal session)

Implements abstract org.h2.expression.Expression.getValue.

Doc from org.h2.expression.Expression.getValue.

Return the resulting value for the current row.

Parameters
session:SessionLocal

the session

Returns:Value

the result

Annotations
@Override
needParenthesesback to summary
public boolean needParentheses()

Overrides org.h2.expression.Expression.needParentheses.

Doc from org.h2.expression.Expression.needParentheses.

Returns whether this expressions needs to be wrapped in parentheses when it is used as an argument of other expressions.

Returns:boolean

true if it is

Annotations
@Override
optimizeback to summary
public Expression optimize(SessionLocal session)

Implements abstract org.h2.expression.Expression.optimize.

Doc from org.h2.expression.Expression.optimize.

Try to optimize the expression.

Parameters
session:SessionLocal

the session

Returns:Expression

the optimized expression

Annotations
@Override
optimizeDateTimeback to summary
private Expression optimizeDateTime(SessionLocal session, int l, int r)
optimizeDecfloatback to summary
private void optimizeDecfloat(TypeInfo leftType, TypeInfo rightType)
optimizeIntervalback to summary
private Expression optimizeInterval(int l, int r)
optimizeNumericback to summary
private void optimizeNumeric(TypeInfo leftType, TypeInfo rightType)
setForcedTypeback to summary
public void setForcedType(TypeInfo forcedType)

Sets a forced data type of a datetime minus datetime operation.

Parameters
forcedType:TypeInfo

the forced data type

swapback to summary
private void swap()
org.h2.expression back to summary

public final Enum BinaryOperation.OpType

extends Enum<BinaryOperation.OpType>
Class Inheritance

Field Summary

Modifier and TypeField and Description
public static final BinaryOperation.OpType
DIVIDE

This operation represents a division as in 4 / 2.

public static final BinaryOperation.OpType
MINUS

This operation represents a subtraction as in 2 - 1.

public static final BinaryOperation.OpType
MULTIPLY

This operation represents a multiplication as in 2 * 3.

public static final BinaryOperation.OpType
PLUS

This operation represents an addition as in 1 + 2.

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static BinaryOperation.OpType
public static BinaryOperation.OpType[]
Inherited from java.lang.Enum:
clonecompareTodescribeConstableequalsfinalizegetDeclaringClasshashCodenameordinaltoStringvalueOf

Field Detail

DIVIDEback to summary
public static final BinaryOperation.OpType DIVIDE

This operation represents a division as in 4 / 2.

MINUSback to summary
public static final BinaryOperation.OpType MINUS

This operation represents a subtraction as in 2 - 1.

MULTIPLYback to summary
public static final BinaryOperation.OpType MULTIPLY

This operation represents a multiplication as in 2 * 3.

PLUSback to summary
public static final BinaryOperation.OpType PLUS

This operation represents an addition as in 1 + 2.

Constructor Detail

OpTypeback to summary
private OpType()

Method Detail

valueOfback to summary
public static BinaryOperation.OpType valueOf(String name)
valuesback to summary
public static BinaryOperation.OpType[] values()