Class IndexCondition
java.lang.Object
org.h2.index.IndexCondition
A index condition object is made for each condition that can potentially use
an index. This class does not extend expression, but in general there is one
expression that maps to each index condition.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intA bit of a search mask meaning 'the condition is always false'.private final Columnprivate final intsee constants inComparisonstatic final intA bit of a search mask meaning 'smaller or equal'.static final intA bit of a search mask meaning 'equal'.private final Expressionprivate List<Expression> private Querystatic final intA search mask meaning 'between'.static final intA bit of a search mask meaning 'spatial intersection'.static final intA bit of a search mask meaning 'larger or equal'. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateIndexCondition(int compareType, ExpressionColumn column, Expression expression) -
Method Summary
Modifier and TypeMethodDescriptionprivate static StringBuildercompareTypeToString(StringBuilder builder, int i) static IndexConditionget(int compareType, ExpressionColumn column, Expression expression) Create an index condition with the given parameters.Get the referenced column.intGet the current result of the expression.getCurrentValue(SessionLocal session) Get the current value of the expression.Value[]getCurrentValueList(SessionLocal session) Get the current value list of the expression.Get expression.Get expression list.Get expression query.static IndexConditiongetInList(ExpressionColumn column, List<Expression> list) Create an index condition with the compare type IN_LIST and with the given parameters.static IndexConditiongetInQuery(ExpressionColumn column, Query query) Create an index condition with the compare type IN_QUERY and with the given parameters.intgetMask(ArrayList<IndexCondition> indexConditions) Get the comparison bit mask.getSQL(int sqlFlags) Get the SQL snippet of this comparison.booleanCheck if the result is always false.booleanisEnd()Check if this index condition is of the type column smaller or equal to value.booleanCheck if the expression can be evaluated.booleanCheck if this index condition is of the type spatial column intersects value.booleanisStart()Check if this index condition is of the type column larger or equal to value.toString()
-
Field Details
-
EQUALITY
public static final int EQUALITYA bit of a search mask meaning 'equal'.- See Also:
-
START
public static final int STARTA bit of a search mask meaning 'larger or equal'.- See Also:
-
END
public static final int ENDA bit of a search mask meaning 'smaller or equal'.- See Also:
-
RANGE
public static final int RANGEA search mask meaning 'between'.- See Also:
-
ALWAYS_FALSE
public static final int ALWAYS_FALSEA bit of a search mask meaning 'the condition is always false'.- See Also:
-
SPATIAL_INTERSECTS
public static final int SPATIAL_INTERSECTSA bit of a search mask meaning 'spatial intersection'.- See Also:
-
column
-
compareType
private final int compareTypesee constants inComparison -
expression
-
expressionList
-
expressionQuery
-
-
Constructor Details
-
IndexCondition
- Parameters:
compareType- the comparison type, see constants inComparison
-
-
Method Details
-
get
Create an index condition with the given parameters.- Parameters:
compareType- the comparison type, see constants inComparisoncolumn- the columnexpression- the expression- Returns:
- the index condition
-
getInList
Create an index condition with the compare type IN_LIST and with the given parameters.- Parameters:
column- the columnlist- the expression list- Returns:
- the index condition
-
getInQuery
Create an index condition with the compare type IN_QUERY and with the given parameters.- Parameters:
column- the columnquery- the select statement- Returns:
- the index condition
-
getCurrentValue
Get the current value of the expression.- Parameters:
session- the session- Returns:
- the value
-
getCurrentValueList
Get the current value list of the expression. The value list is of the same type as the column, distinct, and sorted.- Parameters:
session- the session- Returns:
- the value list
-
getCurrentResult
Get the current result of the expression. The rows may not be of the same type, therefore the rows may not be unique.- Returns:
- the result
-
getSQL
Get the SQL snippet of this comparison.- Parameters:
sqlFlags- formatting flags- Returns:
- the SQL snippet
-
getMask
Get the comparison bit mask.- Parameters:
indexConditions- all index conditions- Returns:
- the mask
-
isAlwaysFalse
public boolean isAlwaysFalse()Check if the result is always false.- Returns:
- true if the result will always be false
-
isStart
public boolean isStart()Check if this index condition is of the type column larger or equal to value.- Returns:
- true if this is a start condition
-
isEnd
public boolean isEnd()Check if this index condition is of the type column smaller or equal to value.- Returns:
- true if this is a end condition
-
isSpatialIntersects
public boolean isSpatialIntersects()Check if this index condition is of the type spatial column intersects value.- Returns:
- true if this is a spatial intersects condition
-
getCompareType
public int getCompareType() -
getColumn
-
getExpression
-
getExpressionList
-
getExpressionQuery
-
isEvaluatable
public boolean isEvaluatable()Check if the expression can be evaluated.- Returns:
- true if it can be evaluated
-
toString
-
compareTypeToString
-