Package org.h2.expression
Class TypedValueExpression
- java.lang.Object
-
- org.h2.expression.Expression
-
- org.h2.expression.Operation0
-
- org.h2.expression.ValueExpression
-
- org.h2.expression.TypedValueExpression
-
public class TypedValueExpression extends ValueExpression
An expression representing a constant value with a type cast.
-
-
Field Summary
Fields Modifier and Type Field Description private TypeInfo
type
static TypedValueExpression
UNKNOWN
The expression represents the SQL UNKNOWN value.-
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
Constructors Modifier Constructor Description private
TypedValueExpression(Value value, TypeInfo type)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static ValueExpression
get(Value value, TypeInfo type)
Create a new expression with the given value and type.private static ValueExpression
getImpl(Value value, TypeInfo type, boolean preserveStrictType)
TypeInfo
getType()
Returns the data type.static ValueExpression
getTypedIfNull(Value value, TypeInfo type)
Create a new typed value expression with the given value and type if value isNULL
, or a plain value expression otherwise.java.lang.StringBuilder
getUnenclosedSQL(java.lang.StringBuilder builder, int sqlFlags)
Get the SQL statement of this expression.boolean
isNullConstant()
Check if this expression will always return the NULL value.-
Methods inherited from class org.h2.expression.ValueExpression
createIndexConditions, get, getBoolean, getBoolean, getCost, getNotIfPossible, getValue, isConstant, isEverything, isValueSet
-
Methods inherited from class org.h2.expression.Operation0
mapColumns, optimize, setEvaluatable, updateAggregate
-
Methods inherited from class org.h2.expression.Expression
addFilterConditions, getAlias, getBooleanValue, getColumnName, getColumnNameForView, getEnclosedSQL, getNonAliasExpression, getNullable, getSchemaName, getSQL, getSQL, getSQL, getSQL, getSubexpression, getSubexpressionCount, getTableAlias, getTableName, getWhenSQL, getWhenValue, isIdentity, isWhenConditionOperand, needParentheses, 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 Detail
-
UNKNOWN
public static final TypedValueExpression UNKNOWN
The expression represents the SQL UNKNOWN value.
-
type
private final TypeInfo type
-
-
Method Detail
-
get
public static ValueExpression get(Value value, TypeInfo type)
Create a new expression with the given value and type.- Parameters:
value
- the valuetype
- the value type- Returns:
- the expression
-
getTypedIfNull
public static ValueExpression getTypedIfNull(Value value, TypeInfo type)
Create a new typed value expression with the given value and type if value isNULL
, or a plain value expression otherwise.- Parameters:
value
- the valuetype
- the value type- Returns:
- the expression
-
getImpl
private static ValueExpression getImpl(Value value, TypeInfo type, boolean preserveStrictType)
-
getType
public TypeInfo getType()
Description copied from class:Expression
Returns the data type. The data type may be unknown before the optimization phase.- Specified by:
getType
in interfaceTyped
- Overrides:
getType
in classValueExpression
- Returns:
- the data type
-
getUnenclosedSQL
public java.lang.StringBuilder getUnenclosedSQL(java.lang.StringBuilder builder, int sqlFlags)
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.- Overrides:
getUnenclosedSQL
in classValueExpression
- Parameters:
builder
- string buildersqlFlags
- formatting flags- Returns:
- the specified string builder
-
isNullConstant
public boolean isNullConstant()
Description copied from class:Expression
Check if this expression will always return the NULL value.- Overrides:
isNullConstant
in classValueExpression
- Returns:
- if the expression is constant NULL value
-
-