ModSQL
Interface DatabaseIndex

All Superinterfaces:
DatabaseTableBase
All Known Implementing Classes:
IndexTable

public interface DatabaseIndex
extends DatabaseTableBase

Interface to be implemented by table indices.

An implementation of DatabaseTable returns objects of this type when requests are made to open an index on a specific column. It is possible for table classes to also implement DatabaseIndex and return "this" when asked for a specific index. ModSQL will never use more than one index for a specific table at one time, nor will it access the table through both an index and the table simultaneously.

Author:
chris.studholme@utoronto.ca
See Also:
DatabaseTable

Method Summary
 boolean findNext(Object data)
          Finds the next row that has the specified data in the indexed column.
 long getDistinctCount()
          Returns the number of distinct values stored in the indexed column in the underlying table.
 long getNullCount()
          Returns the number of null values stored in the indexed column in the underlying table.
 
Methods inherited from interface ModSQL.DatabaseTableBase
afterLast, beforeFirst, close, commitUpdates, deleteRow, getObject, getRowCount, getRowId, isAfterLast, isBeforeFirst, next, updateObject
 

Method Detail

getDistinctCount

public long getDistinctCount()
                      throws DatabaseException
Returns the number of distinct values stored in the indexed column in the underlying table. This method may return an approximation.
Returns:
number of distinct values
Throws:
DatabaseException - if a database-access error occurs

getNullCount

public long getNullCount()
                  throws DatabaseException
Returns the number of null values stored in the indexed column in the underlying table. This method may return an approximation.
Returns:
number of null values
Throws:
DatabaseException - if a database-access error occurs

findNext

public boolean findNext(Object data)
                 throws DatabaseException
Finds the next row that has the specified data in the indexed column. Returns false if no such row could be found. The search always begins at the next row in the database and continues to the last row in the database.
Parameters:
data - desired data
Returns:
true if the new current row is valid; false otherwise
Throws:
DatabaseException - if a database-access error occurs