Top Description Fields Constructors Methods
org.h2.expression.function

public final Class CastSpecification

extends Function1_2
Class Inheritance
Imports
org.h2.engine.SessionLocal, org.h2.expression.Expression, .TypedValueExpression, .ValueExpression, org.h2.message.DbException, org.h2.schema.Domain, org.h2.table.Column, org.h2.util.DateTimeTemplate, .HasSQL, org.h2.value.DataType, .TypeInfo, .Value, .ValueNull, .ValueVarchar

A cast specification.

Field Summary

Modifier and TypeField and Description
private Domain

Constructor Summary

AccessConstructor and Description
public
public
public

Method Summary

Modifier and TypeMethod and Description
private static boolean
canOptimizeCast(int src, int dst)

public String
public TypeInfo
getTypeIfStaticallyKnown(SessionLocal
the session
session
)

Overrides org.h2.expression.Expression.getTypeIfStaticallyKnown.

Returns data type of this expression if it is statically known.

public StringBuilder
getUnenclosedSQL(StringBuilder
string builder
builder
,
int
formatting flags
sqlFlags
)

Overrides org.h2.expression.function.Function1_2.getUnenclosedSQL.

Get the SQL statement of this expression.

protected Value
getValue(SessionLocal
the session
session
,
Value
the value of first argument
v1
,
Value
the value of second argument, or null
v2
)

Overrides org.h2.expression.function.Function1_2.getValue.

Returns the value of this function.

private Value
public boolean
isConstant()

Overrides org.h2.expression.Expression.isConstant.

Check if this expression will always return the same value.

public Expression
optimize(SessionLocal
the session
session
)

Implements abstract org.h2.expression.Expression.optimize.

Try to optimize the expression.

Inherited from org.h2.expression.function.Function1_2:
getValue

Field Detail

domainback to summary
private Domain domain

Constructor Detail

CastSpecificationback to summary
public CastSpecification(Expression arg, Column column, Expression template)
CastSpecificationback to summary
public CastSpecification(Expression arg, Column column)
CastSpecificationback to summary
public CastSpecification(Expression arg, TypeInfo type)

Method Detail

canOptimizeCastback to summary
private static boolean canOptimizeCast(int src, int dst)
getNameback to summary
public String getName()

Implements org.h2.expression.function.NamedExpression.getName.

Doc from org.h2.expression.function.NamedExpression.getName.

Get the name.

Returns:String

the name in uppercase

Annotations
@Override
getTypeIfStaticallyKnownback to summary
public TypeInfo getTypeIfStaticallyKnown(SessionLocal session)

Overrides org.h2.expression.Expression.getTypeIfStaticallyKnown.

Doc from org.h2.expression.Expression.getTypeIfStaticallyKnown.

Returns data type of this expression if it is statically known.

Parameters
session:SessionLocal

the session

Returns:TypeInfo

data type or null

Annotations
@Override
getUnenclosedSQLback to summary
public StringBuilder getUnenclosedSQL(StringBuilder builder, int sqlFlags)

Overrides org.h2.expression.function.Function1_2.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
protected Value getValue(SessionLocal session, Value v1, Value v2)

Overrides org.h2.expression.function.Function1_2.getValue.

Doc from org.h2.expression.function.Function1_2.getValue.

Returns the value of this function.

Parameters
session:SessionLocal

the session

v1:Value

the value of first argument

v2:Value

the value of second argument, or null

Returns:Value

the resulting value

Annotations
@Override
getValueWithTemplateback to summary
private Value getValueWithTemplate(Value v, Value template, SessionLocal session)
isConstantback to summary
public boolean isConstant()

Overrides org.h2.expression.Expression.isConstant.

Doc from org.h2.expression.Expression.isConstant.

Check if this expression will always return the same value.

Returns:boolean

if the expression is constant

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