Top Description Fields Constructors Methods
org.h2.index

public Class IndexCursor

extends Object
implements Cursor
Class Inheritance
All Implemented Interfaces
org.h2.index.Cursor
Imports
java.util.ArrayList, org.h2.engine.SessionLocal, org.h2.expression.condition.Comparison, org.h2.message.DbException, org.h2.result.ResultInterface, .Row, .SearchRow, .SortOrder, org.h2.table.Column, .IndexColumn, .Table, org.h2.value.Value, .ValueGeometry, .ValueNull, .ValueRow

The filter used to walk through an index. This class supports IN(..) and IN(SELECT ...) optimizations.
Authors
Thomas Mueller, Noel Grandin, Nicolas Fortin, Atelier SIG, IRSTV FR CNRS 24888

Field Summary

Modifier and TypeField and Description
private boolean
private Cursor
private SearchRow
private Object
inColumn

Contains a Column or Column[] depending on the condition type.

private Index
private IndexColumn[]
private Value[]
private int
private ResultInterface
private SearchRow
private boolean
private SessionLocal
private SearchRow
private Table

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
private boolean
private boolean
private boolean
public static boolean
canUseIndexForIn(Index index, Column[] columns)

Return true if Index#getIndexColumns() and the columns parameter contains the same elements in the same order.

public void
find(SessionLocal
the session
s
,
ArrayList<IndexCondition>
the index conditions
indexConditions
)

Re-evaluate the start and end values of the index search for rows.

private void
public Row
get()

Implements org.h2.index.Cursor.get.

Get the complete current row.

public SearchRow

Returns:

search row
getEnd
()

Get end search row.

private Value
getMax(Value a, Value b, boolean bigger)

private SearchRow
getSearchRow(SearchRow row, int columnId, Value v, boolean max)

public SearchRow
getSearchRow()

Implements org.h2.index.Cursor.getSearchRow.

Get the current row.

private SearchRow
getSpatialSearchRow(SearchRow row, int columnId, Value v)

public SearchRow

Returns:

search row
getStart
()

Get start search row.

public boolean

Returns:

true if it is
isAlwaysFalse
()

Check if the result is empty for sure.

public boolean
next()

Implements org.h2.index.Cursor.next.

Skip to the next row if one is available.

private void
public void
prepare(SessionLocal
Session.
s
,
ArrayList<IndexCondition>
Index conditions.
indexConditions
)

Prepare this index cursor to make a lookup in index.

public boolean
previous()

Implements org.h2.index.Cursor.previous.

Skip to the previous row if one is available.

public void
setIndex(Index index, boolean reverse)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

alwaysFalseback to summary
private boolean alwaysFalse
cursorback to summary
private Cursor cursor
endback to summary
private SearchRow end
inColumnback to summary
private Object inColumn

Contains a Column or Column[] depending on the condition type.

See Also
IndexCondition#isCompoundColumns()
indexback to summary
private Index index
indexColumnsback to summary
private IndexColumn[] indexColumns
inListback to summary
private Value[] inList
inListIndexback to summary
private int inListIndex
inResultback to summary
private ResultInterface inResult
intersectsback to summary
private SearchRow intersects
reverseback to summary
private boolean reverse
sessionback to summary
private SessionLocal session
startback to summary
private SearchRow start
tableback to summary
private Table table

Constructor Detail

IndexCursorback to summary
public IndexCursor()

Method Detail

canUseIndexForback to summary
private boolean canUseIndexFor(Column column)
canUseIndexForInback to summary
private boolean canUseIndexForIn(Column column)
canUseIndexForInback to summary
private boolean canUseIndexForIn(Column[] columns)
canUseIndexForInback to summary
public static boolean canUseIndexForIn(Index index, Column[] columns)

Return true if Index#getIndexColumns() and the columns parameter contains the same elements in the same order. All column of the index must match the column in the columns array, or it must be a VIEW index (where the column is null).

See Also
IndexCondition#getMask(ArrayList)
findback to summary
public void find(SessionLocal s, ArrayList<IndexCondition> indexConditions)

Re-evaluate the start and end values of the index search for rows.

Parameters
s:SessionLocal

the session

indexConditions:ArrayList<IndexCondition>

the index conditions

findback to summary
private void find(Value v)
getback to summary
public Row get()

Implements org.h2.index.Cursor.get.

Doc from org.h2.index.Cursor.get.

Get the complete current row. All column are available.

Returns:Row

the complete row

Annotations
@Override
getEndback to summary
public SearchRow getEnd()

Get end search row.

Returns:SearchRow

search row

getMaxback to summary
private Value getMax(Value a, Value b, boolean bigger)
getSearchRowback to summary
private SearchRow getSearchRow(SearchRow row, int columnId, Value v, boolean max)
getSearchRowback to summary
public SearchRow getSearchRow()

Implements org.h2.index.Cursor.getSearchRow.

Doc from org.h2.index.Cursor.getSearchRow.

Get the current row. Only the data for indexed columns is available in this row.

Returns:SearchRow

the search row

Annotations
@Override
getSpatialSearchRowback to summary
private SearchRow getSpatialSearchRow(SearchRow row, int columnId, Value v)
getStartback to summary
public SearchRow getStart()

Get start search row.

Returns:SearchRow

search row

isAlwaysFalseback to summary
public boolean isAlwaysFalse()

Check if the result is empty for sure.

Returns:boolean

true if it is

nextback to summary
public boolean next()

Implements org.h2.index.Cursor.next.

Doc from org.h2.index.Cursor.next.

Skip to the next row if one is available.

Returns:boolean

true if another row is available

Annotations
@Override
nextCursorback to summary
private void nextCursor()
prepareback to summary
public void prepare(SessionLocal s, ArrayList<IndexCondition> indexConditions)

Prepare this index cursor to make a lookup in index.

Parameters
s:SessionLocal

Session.

indexConditions:ArrayList<IndexCondition>

Index conditions.

previousback to summary
public boolean previous()

Implements org.h2.index.Cursor.previous.

Doc from org.h2.index.Cursor.previous.

Skip to the previous row if one is available. No filtering is made here.

Returns:boolean

true if another row is available

Annotations
@Override
setIndexback to summary
public void setIndex(Index index, boolean reverse)