Package org.h2.index

# Class DualIndex

java.lang.Object
org.h2.engine.DbObject
org.h2.schema.SchemaObject
org.h2.index.Index
org.h2.index.VirtualTableIndex
org.h2.index.DualIndex

All Implemented Interfaces:
  `HasSQL`

public class DualIndex extends VirtualTableIndex
An index for the DUAL table.

## Field Summary

### Fields inherited from class org.h2.index.Index

`columnIds, columns, indexColumns, indexType, table, uniqueColumnColumn`

### Fields inherited from class org.h2.engine.DbObject

`AGGREGATE, comment, COMMENT, CONSTANT, CONSTRAINT, database, DOMAIN, FUNCTION_ALIAS, INDEX, RIGHT, ROLE, SCHEMA, SEQUENCE, SETTING, SYNONYM, TABLE_OR_VIEW, trace, TRIGGER, USER`

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

## Constructor Summary

Constructors
Constructor
Description
`DualIndex(DualTable table)`

## Method Summary

Modifier and Type
Method
Description
`boolean`
`canGetFirstOrLast()`
Check if the index can directly look up the lowest or highest value of a column.
`Cursor`
`find(SessionLocal session, SearchRow first, SearchRow last, boolean reverse)`
Find a row or a list of rows and create a cursor to iterate over the result.
`Cursor`
`findFirstOrLast(SessionLocal session, boolean first)`
Find the first (or last) value of this index.
`double`
`getCost(SessionLocal session, int[] masks, TableFilter[] filters, int filter, SortOrder sortOrder, AllColumnsForPlan allColumnsSet, boolean isSelectCommand)`
Estimate the cost to search for rows given the search mask.
`String`
`getCreateSQL()`
Construct the CREATE ...
`String`
`getPlanSQL()`
Get the message to show in a EXPLAIN statement.

### Methods inherited from class org.h2.index.VirtualTableIndex

`add, checkRename, close, getRowCount, getRowCountApproximation, needRebuild, remove, remove, truncate`

### Methods inherited from class org.h2.index.Index

`canFindNext, canScan, checkIndexColumnTypes, compareRows, findNext, getColumnIndex, getColumns, getCostRangeIndex, getCreateSQLForCopy, getDiskSpaceUsed, getDuplicateKeyException, getDuplicatePrimaryKeyMessage, getIndexColumns, getIndexType, getRow, getRowFactory, getTable, getType, getUniqueColumnCount, getUniqueRowFactory, isFindUsingFullTableScan, isFirstColumn, isRowIdIndex, needsUniqueCheck, removeChildrenAndResources, update`

### Methods inherited from class org.h2.schema.SchemaObject

`getSchema, getSQL, getSQL`

### Methods inherited from class org.h2.engine.DbObject

`equals, getChildren, getComment, getCreateSQLForMeta, getDatabase, getDropSQL, getId, getModificationId, getName, hashCode, invalidate, isTemporary, isValid, rename, setComment, setModified, setObjectName, setTemporary, toString`

### Methods inherited from class java.lang.Object

`clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

### Methods inherited from interface org.h2.util.HasSQL

`getTraceSQL`

## Constructor Details

### DualIndex

public DualIndex(DualTable table)

## Method Details

### find

public Cursor find(SessionLocal session, SearchRow first, SearchRow last, boolean reverse)
Description copied from class: `Index`
Find a row or a list of rows and create a cursor to iterate over the result.

Specified by:
  `find` in class `Index`
Parameters:
  `session` - the session
  `first` - the first row, or null for no limit
  `last` - the last row, or null for no limit
  `reverse` - if true, iterate in reverse (descending) order
Returns:
  the cursor to iterate over the results

### getCost

public double getCost(SessionLocal session, int[] masks, TableFilter[] filters, int filter, SortOrder sortOrder, AllColumnsForPlan allColumnsSet, boolean isSelectCommand)
Description copied from class: `Index`
Estimate the cost to search for rows given the search mask. There is one element per column in the search mask. For possible search masks, see IndexCondition.

Specified by:
  `getCost` in class `Index`
Parameters:
  `session` - the session
  `masks` - per-column comparison bit masks, null means 'always false', see constants in IndexCondition
  `filters` - all joined table filters
  `filter` - the current table filter index
  `sortOrder` - the sort order
  `allColumnsSet` - the set of all columns
  `isSelectCommand` - is this for an SELECT command
Returns:
  the estimated cost

### getCreateSQL

public String getCreateSQL()
Description copied from class: `DbObject`
Construct the CREATE ... SQL statement for this object.

Overrides:
  `getCreateSQL` in class `Index`
Returns:
  the SQL statement

### canGetFirstOrLast

public boolean canGetFirstOrLast()
Description copied from class: `Index`
Check if the index can directly look up the lowest or highest value of a column.

Overrides:
  `canGetFirstOrLast` in class `Index`
Returns:
  true if it can

### findFirstOrLast

public Cursor findFirstOrLast(SessionLocal session, boolean first)
Description copied from class: `Index`
Find the first (or last) value of this index. The cursor returned is positioned on the correct row, or on null if no row has been found.

Overrides:
  `findFirstOrLast` in class `Index`
Parameters:
  `session` - the session
  `first` - true if the first (lowest for ascending indexes) or last value should be returned
Returns:
  a cursor (never null)

### getPlanSQL

public String getPlanSQL()
Description copied from class: `Index`
Get the message to show in a EXPLAIN statement.

Overrides:
  `getPlanSQL` in class `Index`
Returns:
  the plan