org.h2.index
Class NonUniqueHashIndex

java.lang.Object
  extended by org.h2.engine.DbObjectBase
      extended by org.h2.schema.SchemaObjectBase
          extended by org.h2.index.BaseIndex
              extended by org.h2.index.HashIndex
                  extended by org.h2.index.NonUniqueHashIndex
All Implemented Interfaces:
DbObject, Index, SchemaObject

public class NonUniqueHashIndex
extends HashIndex

A non-unique index based on an in-memory hash map.


Field Summary
 
Fields inherited from class org.h2.index.HashIndex
indexColumn
 
Fields inherited from class org.h2.index.BaseIndex
columnIds, columns, indexColumns, indexType, isMultiVersion, table
 
Fields inherited from class org.h2.engine.DbObjectBase
comment, database, trace
 
Fields inherited from interface org.h2.engine.DbObject
AGGREGATE, COMMENT, CONSTANT, CONSTRAINT, FUNCTION_ALIAS, INDEX, RIGHT, ROLE, SCHEMA, SEQUENCE, SETTING, TABLE_OR_VIEW, TRIGGER, USER, USER_DATATYPE
 
Constructor Summary
NonUniqueHashIndex(RegularTable table, int id, java.lang.String indexName, IndexColumn[] columns, IndexType indexType)
           
 
Method Summary
 void add(Session session, Row row)
          Add a row to the index.
 Cursor find(Session session, SearchRow first, SearchRow last)
          Find a row or a list of rows and create a cursor to iterate over the result.
 long getRowCount(Session session)
          Get the row count of this table, for the given session.
 long getRowCountApproximation()
          Get the approximated row count for this table.
 void remove(Session session, Row row)
          Remove a row from the index.
 void truncate(Session session)
          Remove all rows from the index.
 
Methods inherited from class org.h2.index.HashIndex
canGetFirstOrLast, canScan, checkRename, close, findFirstOrLast, getCost, getDiskSpaceUsed, needRebuild, remove
 
Methods inherited from class org.h2.index.BaseIndex
canFindNext, commit, compareRows, containsNullAndAllowMultipleNull, find, findNext, getColumnIndex, getColumns, getCostRangeIndex, getCreateSQL, getCreateSQLForCopy, getDropSQL, getDuplicateKeyException, getIndexColumns, getIndexType, getPlanSQL, getRow, getTable, getType, initBaseIndex, isHidden, isRowIdIndex, removeChildrenAndResources, setSortedInsertMode
 
Methods inherited from class org.h2.schema.SchemaObjectBase
getSchema, getSQL, initSchemaObjectBase
 
Methods inherited from class org.h2.engine.DbObjectBase
getChildren, getComment, getDatabase, getId, getModificationId, getName, initDbObjectBase, invalidate, isTemporary, rename, setComment, setModified, setObjectName, setTemporary, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.h2.schema.SchemaObject
getSchema
 
Methods inherited from interface org.h2.engine.DbObject
getChildren, getComment, getDatabase, getId, getName, getSQL, isTemporary, rename, setComment, setTemporary
 

Constructor Detail

NonUniqueHashIndex

public NonUniqueHashIndex(RegularTable table,
                          int id,
                          java.lang.String indexName,
                          IndexColumn[] columns,
                          IndexType indexType)
Method Detail

truncate

public void truncate(Session session)
Description copied from interface: Index
Remove all rows from the index.

Specified by:
truncate in interface Index
Overrides:
truncate in class HashIndex
Parameters:
session - the session

add

public void add(Session session,
                Row row)
Description copied from interface: Index
Add a row to the index.

Specified by:
add in interface Index
Overrides:
add in class HashIndex
Parameters:
session - the session to use
row - the row to add

remove

public void remove(Session session,
                   Row row)
Description copied from interface: Index
Remove a row from the index.

Specified by:
remove in interface Index
Overrides:
remove in class HashIndex
Parameters:
session - the session
row - the row

find

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

Specified by:
find in interface Index
Overrides:
find in class HashIndex
Parameters:
session - the session
first - the first row, or null for no limit
last - the last row, or null for no limit
Returns:
the cursor to iterate over the results

getRowCount

public long getRowCount(Session session)
Description copied from interface: Index
Get the row count of this table, for the given session.

Specified by:
getRowCount in interface Index
Overrides:
getRowCount in class HashIndex
Parameters:
session - the session
Returns:
the row count

getRowCountApproximation

public long getRowCountApproximation()
Description copied from interface: Index
Get the approximated row count for this table.

Specified by:
getRowCountApproximation in interface Index
Overrides:
getRowCountApproximation in class HashIndex
Returns:
the approximated row count