Top Description Inners Fields Constructors Methods
org.h2.expression

public Class IntervalOperation

extends Operation2
Class Inheritance
Static Imports
org.h2.util.DateTimeUtils.NANOS_PER_DAY, .DateTimeUtils.NANOS_PER_HOUR, .DateTimeUtils.NANOS_PER_SECOND, .DateTimeUtils.absoluteDayFromDateValue, .DateTimeUtils.dateAndTimeFromValue, .DateTimeUtils.dateTimeToValue, .DateTimeUtils.dateValueFromAbsoluteDay, .IntervalUtils.NANOS_PER_DAY_BI

A mathematical operation with intervals.

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static enum

Field Summary

Modifier and TypeField and Description
private TypeInfo
private static final int
INTERVAL_DAY_DIGITS

Number of digits enough to hold INTERVAL '999999999999999999' DAY / INTERVAL '0.000000001' SECOND.

private static final TypeInfo
private static final TypeInfo
private static final int
INTERVAL_YEAR_DIGITS

Number of digits enough to hold INTERVAL '999999999999999999' YEAR / INTERVAL '1' MONTH.

private final IntervalOperation.IntervalOpType
Inherited from org.h2.expression.Operation2:
leftrighttype

Constructor Summary

AccessConstructor and Description
public
public

Method Summary

Modifier and TypeMethod and Description
private Value
getDateTimeWithInterval(SessionLocal session, Value l, Value r, int lType, int rType)

pack-priv static StringBuilder
private void
getInnerSQL2(StringBuilder builder, int sqlFlags)

private char
private long
getTimeWithInterval(Value r, long nanos)

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.

public Value
getValue(SessionLocal
the session
session
)

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

Return the resulting value for the current row.

private static BigInteger
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.

Inherited from org.h2.expression.Operation2:
getCostgetSubexpressiongetSubexpressionCountgetTypeisEverythingmapColumnssetEvaluatableupdateAggregate

Field Detail

forcedTypeback to summary
private TypeInfo forcedType
INTERVAL_DAY_DIGITSback to summary
private static final int INTERVAL_DAY_DIGITS

Number of digits enough to hold INTERVAL '999999999999999999' DAY / INTERVAL '0.000000001' SECOND.

INTERVAL_DIVIDE_INTERVAL_DAY_TYPEback to summary
private static final TypeInfo INTERVAL_DIVIDE_INTERVAL_DAY_TYPE
INTERVAL_DIVIDE_INTERVAL_YEAR_TYPEback to summary
private static final TypeInfo INTERVAL_DIVIDE_INTERVAL_YEAR_TYPE
INTERVAL_YEAR_DIGITSback to summary
private static final int INTERVAL_YEAR_DIGITS

Number of digits enough to hold INTERVAL '999999999999999999' YEAR / INTERVAL '1' MONTH.

opTypeback to summary
private final IntervalOperation.IntervalOpType opType

Constructor Detail

IntervalOperationback to summary
public IntervalOperation(IntervalOperation.IntervalOpType opType, Expression left, Expression right, TypeInfo forcedType)
IntervalOperationback to summary
public IntervalOperation(IntervalOperation.IntervalOpType opType, Expression left, Expression right)

Method Detail

getDateTimeWithIntervalback to summary
private Value getDateTimeWithInterval(SessionLocal session, Value l, Value r, int lType, int rType)
getForcedTypeSQLback to summary
pack-priv static StringBuilder getForcedTypeSQL(StringBuilder builder, TypeInfo forcedType)
getInnerSQL2back to summary
private void getInnerSQL2(StringBuilder builder, int sqlFlags)
getOperationTokenback to summary
private char getOperationToken()
getTimeWithIntervalback to summary
private long getTimeWithInterval(Value r, long nanos)
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
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
nanosFromValueback to summary
private static BigInteger nanosFromValue(SessionLocal session, Value v)
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
org.h2.expression back to summary

public final Enum IntervalOperation.IntervalOpType

extends Enum<IntervalOperation.IntervalOpType>
Class Inheritance

Field Summary

Modifier and TypeField and Description
public static final IntervalOperation.IntervalOpType
DATETIME_MINUS_DATETIME

Date-time minus date-time.

public static final IntervalOperation.IntervalOpType
DATETIME_MINUS_INTERVAL

Date-time minus interval.

public static final IntervalOperation.IntervalOpType
DATETIME_PLUS_INTERVAL

Date-time plus interval.

public static final IntervalOperation.IntervalOpType
INTERVAL_DIVIDE_INTERVAL

Interval divided by interval (non-standard).

public static final IntervalOperation.IntervalOpType
INTERVAL_DIVIDE_NUMERIC

Interval divided by numeric.

public static final IntervalOperation.IntervalOpType
INTERVAL_MINUS_INTERVAL

Interval minus interval.

public static final IntervalOperation.IntervalOpType
INTERVAL_MULTIPLY_NUMERIC

Interval multiplied by numeric.

public static final IntervalOperation.IntervalOpType
INTERVAL_PLUS_INTERVAL

Interval plus interval.

Constructor Summary

AccessConstructor and Description
private

Method Summary

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

Field Detail

DATETIME_MINUS_DATETIMEback to summary
public static final IntervalOperation.IntervalOpType DATETIME_MINUS_DATETIME

Date-time minus date-time.

DATETIME_MINUS_INTERVALback to summary
public static final IntervalOperation.IntervalOpType DATETIME_MINUS_INTERVAL

Date-time minus interval.

DATETIME_PLUS_INTERVALback to summary
public static final IntervalOperation.IntervalOpType DATETIME_PLUS_INTERVAL

Date-time plus interval.

INTERVAL_DIVIDE_INTERVALback to summary
public static final IntervalOperation.IntervalOpType INTERVAL_DIVIDE_INTERVAL

Interval divided by interval (non-standard).

INTERVAL_DIVIDE_NUMERICback to summary
public static final IntervalOperation.IntervalOpType INTERVAL_DIVIDE_NUMERIC

Interval divided by numeric.

INTERVAL_MINUS_INTERVALback to summary
public static final IntervalOperation.IntervalOpType INTERVAL_MINUS_INTERVAL

Interval minus interval.

INTERVAL_MULTIPLY_NUMERICback to summary
public static final IntervalOperation.IntervalOpType INTERVAL_MULTIPLY_NUMERIC

Interval multiplied by numeric.

INTERVAL_PLUS_INTERVALback to summary
public static final IntervalOperation.IntervalOpType INTERVAL_PLUS_INTERVAL

Interval plus interval.

Constructor Detail

IntervalOpTypeback to summary
private IntervalOpType()

Method Detail

valueOfback to summary
public static IntervalOperation.IntervalOpType valueOf(String name)
valuesback to summary
public static IntervalOperation.IntervalOpType[] values()