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 TypeInfo
private static final int
Number of digits enough to holdINTERVAL '999999999999999999' DAY / INTERVAL '0.000000001' SECOND
.private static final TypeInfo
private static final TypeInfo
private static final int
Number of digits enough to holdINTERVAL '999999999999999999' YEAR / INTERVAL '1' MONTH
.private final IntervalOperation.IntervalOpType
Fields inherited from class org.h2.expression.Operation2
left, right, type
Fields inherited from class org.h2.expression.Expression
AUTO_PARENTHESES, MAP_IN_AGGREGATE, MAP_IN_WINDOW, MAP_INITIAL, WITH_PARENTHESES, WITHOUT_PARENTHESES
Fields 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 Value
getDateTimeWithInterval
(SessionLocal session, Value l, Value r, int lType, int rType) (package private) static StringBuilder
getForcedTypeSQL
(StringBuilder builder, TypeInfo forcedType) private void
getInnerSQL2
(StringBuilder builder, int sqlFlags) private char
private long
getTimeWithInterval
(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 BigInteger
nanosFromValue
(SessionLocal session, Value v) boolean
Returns 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, updateAggregate
Methods 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, writeExpressions
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods 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:Expression
Returns whether this expressions needs to be wrapped in parentheses when it is used as an argument of other expressions.- Overrides:
needParentheses
in classExpression
- Returns:
true
if it is
-
getUnenclosedSQL
Description copied from class:Expression
Get 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:
getUnenclosedSQL
in classExpression
- Parameters:
builder
- string buildersqlFlags
- formatting flags- Returns:
- the specified string builder
-
getInnerSQL2
-
getForcedTypeSQL
-
getOperationToken
private char getOperationToken() -
getValue
Description copied from class:Expression
Return the resulting value for the current row.- Specified by:
getValue
in classExpression
- Parameters:
session
- the session- Returns:
- the result
-
getDateTimeWithInterval
-
getTimeWithInterval
-
optimize
Description copied from class:Expression
Try to optimize the expression.- Specified by:
optimize
in classExpression
- Parameters:
session
- the session- Returns:
- the optimized expression
-