Top Description Fields Constructors Methods
org.h2.expression

public final Class Parameter

extends Operation0
implements ParameterInterface
Class Inheritance
All Implemented Interfaces
org.h2.expression.ParameterInterface
Imports
java.util.ArrayList, org.h2.api.ErrorCode, org.h2.engine.SessionLocal, org.h2.expression.condition.Comparison, org.h2.message.DbException, org.h2.table.Column, org.h2.value.TypeInfo, .Value, .ValueNull, .ValueVarchar

A parameter of a prepared statement.

Field Summary

Modifier and TypeField and Description
private Column
private final int
private Value

Constructor Summary

AccessConstructor and Description
public
Parameter(int index)

Method Summary

Modifier and TypeMethod and Description
public void
checkSet()

Implements org.h2.expression.ParameterInterface.checkSet.

Check if the value is set.

public int
getCost()

Implements abstract org.h2.expression.Expression.getCost.

Estimate the cost to process the expression.

public int
public static int

Returns:

the maximum 1-based index, or -1
getMaxIndex
(ArrayList<Parameter>
parameters
parameters
)

Returns the maximum 1-based index.

public Expression
getNotIfPossible(SessionLocal
the session
session
)

Overrides org.h2.expression.Expression.getNotIfPossible.

If it is possible, return the negated expression.

public Value
getParamValue()

Implements org.h2.expression.ParameterInterface.getParamValue.

Get the value of the parameter if set.

public TypeInfo
getType()

Implements abstract org.h2.expression.Expression.getType.

Implements org.h2.expression.ParameterInterface.getType, org.h2.value.Typed.getType.

Returns the expected data type if no value is set, or the data type of the value if one is set.

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

Implements abstract org.h2.expression.Expression.getUnenclosedSQL.

Get the SQL statement of this expression.

public Value
getValue(SessionLocal
the session
session
)

Implements abstract org.h2.expression.Expression.getValue.

Return the resulting value for the current row.

public boolean
isEverything(ExpressionVisitor
the visitor
visitor
)

Implements abstract org.h2.expression.Expression.isEverything.

Check if this expression and all sub-expressions can fulfill a criteria.

public boolean
public Expression
optimize(SessionLocal
the session
session
)

Overrides org.h2.expression.Operation0.optimize.

Try to optimize the expression.

public void
setColumn(Column column)

public void
setValue(Value
the new value
v
,
boolean
if the old value (if one is set) should be closed
closeOld
)

Implements org.h2.expression.ParameterInterface.setValue.

Set the value of the parameter.

public void
Inherited from org.h2.expression.Operation0:
mapColumnssetEvaluatableupdateAggregate

Field Detail

columnback to summary
private Column column
indexback to summary
private final int index
valueback to summary
private Value value

Constructor Detail

Parameterback to summary
public Parameter(int index)

Method Detail

checkSetback to summary
public void checkSet()

Implements org.h2.expression.ParameterInterface.checkSet.

Doc from org.h2.expression.ParameterInterface.checkSet.

Check if the value is set.

Annotations
@Override
getCostback to summary
public int getCost()

Implements abstract org.h2.expression.Expression.getCost.

Doc from org.h2.expression.Expression.getCost.

Estimate the cost to process the expression. Used when optimizing the query, to calculate the query plan with the lowest estimated cost.

Returns:int

the estimated cost

Annotations
@Override
getIndexback to summary
public int getIndex()
getMaxIndexback to summary
public static int getMaxIndex(ArrayList<Parameter> parameters)

Returns the maximum 1-based index.

Parameters
parameters:ArrayList<Parameter>

parameters

Returns:int

the maximum 1-based index, or -1

getNotIfPossibleback to summary
public Expression getNotIfPossible(SessionLocal session)

Overrides org.h2.expression.Expression.getNotIfPossible.

Doc from org.h2.expression.Expression.getNotIfPossible.

If it is possible, return the negated expression. This is used to optimize NOT expressions: NOT ID>10 can be converted to ID<=10. Returns null if negating is not possible.

Parameters
session:SessionLocal

the session

Returns:Expression

the negated expression, or null

Annotations
@Override
getParamValueback to summary
public Value getParamValue()

Implements org.h2.expression.ParameterInterface.getParamValue.

Doc from org.h2.expression.ParameterInterface.getParamValue.

Get the value of the parameter if set.

Returns:Value

the value or null

Annotations
@Override
getTypeback to summary
public TypeInfo getType()

Implements abstract org.h2.expression.Expression.getType.

Implements org.h2.expression.ParameterInterface.getType, org.h2.value.Typed.getType.

Doc from org.h2.expression.ParameterInterface.getType.

Returns the expected data type if no value is set, or the data type of the value if one is set.

Returns:TypeInfo

the data type

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

Implements abstract org.h2.expression.Expression.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
public Value getValue(SessionLocal session)

Implements abstract org.h2.expression.Expression.getValue.

Doc from org.h2.expression.Expression.getValue.

Return the resulting value for the current row.

Parameters
session:SessionLocal

the session

Returns:Value

the result

Annotations
@Override
isEverythingback to summary
public boolean isEverything(ExpressionVisitor visitor)

Implements abstract org.h2.expression.Expression.isEverything.

Doc from org.h2.expression.Expression.isEverything.

Check if this expression and all sub-expressions can fulfill a criteria. If any part returns false, the result is false.

Parameters
visitor:ExpressionVisitor

the visitor

Returns:boolean

if the criteria can be fulfilled

Annotations
@Override
isValueSetback to summary
public boolean isValueSet()

Overrides org.h2.expression.Expression.isValueSet.

Implements org.h2.expression.ParameterInterface.isValueSet.

Doc from org.h2.expression.ParameterInterface.isValueSet.

Is the value of a parameter set.

Returns:boolean

true if set

Annotations
@Override
optimizeback to summary
public Expression optimize(SessionLocal session)

Overrides org.h2.expression.Operation0.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
setColumnback to summary
public void setColumn(Column column)
setValueback to summary
public void setValue(Value v, boolean closeOld)

Implements org.h2.expression.ParameterInterface.setValue.

Doc from org.h2.expression.ParameterInterface.setValue.

Set the value of the parameter.

Parameters
v:Value

the new value

closeOld:boolean

if the old value (if one is set) should be closed

Annotations
@Override
setValueback to summary
public void setValue(Value v)