Package org.h2.expression
Class IntervalOperation
java.lang.Object
org.h2.expression.Expression
org.h2.expression.Operation2
org.h2.expression.IntervalOperation
A mathematical operation with intervals.
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate TypeInfoprivate static final intNumber of digits enough to holdINTERVAL '999999999999999999' DAY / INTERVAL '0.000000001' SECOND.private static final TypeInfoprivate static final TypeInfoprivate static final intNumber of digits enough to holdINTERVAL '999999999999999999' YEAR / INTERVAL '1' MONTH.private final IntervalOperation.IntervalOpTypeFields inherited from class org.h2.expression.Operation2
left, right, typeFields inherited from class org.h2.expression.Expression
AUTO_PARENTHESES, MAP_IN_AGGREGATE, MAP_IN_WINDOW, MAP_INITIAL, WITH_PARENTHESES, WITHOUT_PARENTHESESFields inherited from interface org.h2.util.HasSQL
ADD_PLAN_INFORMATION, DEFAULT_SQL_FLAGS, NO_CASTS, QUOTE_ONLY_WHEN_REQUIRED, REPLACE_LOBS_FOR_TRACE, TRACE_SQL_FLAGS -
Constructor Summary
ConstructorsConstructorDescriptionIntervalOperation(IntervalOperation.IntervalOpType opType, Expression left, Expression right) IntervalOperation(IntervalOperation.IntervalOpType opType, Expression left, Expression right, TypeInfo forcedType) -
Method Summary
Modifier and TypeMethodDescriptionprivate ValuegetDateTimeWithInterval(SessionLocal session, Value l, Value r, int lType, int rType) (package private) static StringBuildergetForcedTypeSQL(StringBuilder builder, TypeInfo forcedType) private voidgetInnerSQL2(StringBuilder builder, int sqlFlags) private charprivate longgetTimeWithInterval(Value r, long nanos) getUnenclosedSQL(StringBuilder builder, int sqlFlags) Get the SQL statement of this expression.getValue(SessionLocal session) Return the resulting value for the current row.private static BigIntegernanosFromValue(SessionLocal session, Value v) booleanReturns whether this expressions needs to be wrapped in parentheses when it is used as an argument of other expressions.optimize(SessionLocal session) Try to optimize the expression.Methods inherited from class org.h2.expression.Operation2
getCost, getSubexpression, getSubexpressionCount, getType, isEverything, mapColumns, setEvaluatable, updateAggregateMethods inherited from class org.h2.expression.Expression
addFilterConditions, createIndexConditions, getAlias, getBooleanValue, getColumnName, getColumnNameForView, getEnclosedSQL, getNonAliasExpression, getNotIfPossible, getNullable, getSchemaName, getSQL, getSQL, getSQL, getSQL, getTableAlias, getTableName, getWhenSQL, getWhenValue, isConstant, isIdentity, isNullConstant, isValueSet, isWhenConditionOperand, optimizeCondition, toString, writeExpressions, writeExpressionsMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.h2.util.HasSQL
getTraceSQL
-
Field Details
-
INTERVAL_YEAR_DIGITS
private static final int INTERVAL_YEAR_DIGITSNumber of digits enough to holdINTERVAL '999999999999999999' YEAR / INTERVAL '1' MONTH.- See Also:
-
INTERVAL_DAY_DIGITS
private static final int INTERVAL_DAY_DIGITSNumber of digits enough to holdINTERVAL '999999999999999999' DAY / INTERVAL '0.000000001' SECOND.- See Also:
-
INTERVAL_DIVIDE_INTERVAL_YEAR_TYPE
-
INTERVAL_DIVIDE_INTERVAL_DAY_TYPE
-
opType
-
forcedType
-
-
Constructor Details
-
IntervalOperation
public IntervalOperation(IntervalOperation.IntervalOpType opType, Expression left, Expression right, TypeInfo forcedType) -
IntervalOperation
public IntervalOperation(IntervalOperation.IntervalOpType opType, Expression left, Expression right)
-
-
Method Details
-
nanosFromValue
-
needParentheses
public boolean needParentheses()Description copied from class:ExpressionReturns whether this expressions needs to be wrapped in parentheses when it is used as an argument of other expressions.- Overrides:
needParenthesesin classExpression- Returns:
trueif it is
-
getUnenclosedSQL
Description copied from class:ExpressionGet the SQL statement of this expression. This may not always be the original SQL statement, especially after optimization. Enclosing '(' and ')' are never appended.- Specified by:
getUnenclosedSQLin classExpression- Parameters:
builder- string buildersqlFlags- formatting flags- Returns:
- the specified string builder
-
getInnerSQL2
-
getForcedTypeSQL
-
getOperationToken
private char getOperationToken() -
getValue
Description copied from class:ExpressionReturn the resulting value for the current row.- Specified by:
getValuein classExpression- Parameters:
session- the session- Returns:
- the result
-
getDateTimeWithInterval
-
getTimeWithInterval
-
optimize
Description copied from class:ExpressionTry to optimize the expression.- Specified by:
optimizein classExpression- Parameters:
session- the session- Returns:
- the optimized expression
-