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

All Implemented Interfaces:
  `HasSQL`, `Typed`

public class TypedValueExpression extends ValueExpression
An expression representing a constant value with a type cast.

## Field Summary

Fields
Modifier and Type
Field
Description
`static final TypedValueExpression`
`UNKNOWN`
The expression represents the SQL UNKNOWN value.

### Fields inherited from class org.h2.expression.ValueExpression

`DEFAULT, FALSE, NULL, TRUE`

### 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`

## Method Summary

Modifier and Type
Method
Description
`static ValueExpression`
`get(Value value, TypeInfo type)`
Create a new expression with the given value and type.
`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 is `NULL`, or a plain value expression otherwise.
`StringBuilder`
`getUnenclosedSQL(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, getTypeIfStaticallyKnown, 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 Details

### UNKNOWN

public static final TypedValueExpression UNKNOWN
The expression represents the SQL UNKNOWN value.

## Method Details

### get

public static ValueExpression get(Value value, TypeInfo type)
Create a new expression with the given value and type.

Parameters:
  `value` - the value
  `type` - 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 is `NULL`, or a plain value expression otherwise.

Parameters:
  `value` - the value
  `type` - the value type
Returns:
  the expression

### 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 interface `Typed`
Overrides:
  `getType` in class `ValueExpression`
Returns:
  the data type

### getUnenclosedSQL

public StringBuilder getUnenclosedSQL(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 class `ValueExpression`
Parameters:
  `builder` - string builder
  `sqlFlags` - 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 class `ValueExpression`
Returns:
  if the expression is constant NULL value