ModSQL
Class IndexTable
java.lang.Object
|
+--ModSQL.IndexTable
- All Implemented Interfaces:
- DatabaseIndex, DatabaseTableBase
- Direct Known Subclasses:
- IndexTable_Hash, IndexTable_Sort
- abstract class IndexTable
- extends Object
- implements DatabaseIndex
Abstract base class for built-in table indexing classes.
- Author:
- chris.studholme@utoronto.ca
|
Constructor Summary |
(package private) |
IndexTable()
|
| Methods inherited from class java.lang.Object |
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait |
| Methods inherited from interface ModSQL.DatabaseTableBase |
afterLast, beforeFirst, close, commitUpdates, deleteRow, getObject, getRowCount, getRowId, isAfterLast, isBeforeFirst, next, updateObject |
IndexTable
IndexTable()
openIndex
static IndexTable openIndex(DatabaseTable table,
String columnname)
throws DatabaseException
- Attempt to open index on the specified column of an open table.
- Parameters:
table - open tablecolumnname - name of indexed column- Returns:
- index on column, or null if index not available
- Throws:
DatabaseException - if there is a problem with the index
isIndexAvailable
public static boolean isIndexAvailable(String filename)
- Check if the specified index file is available.
- Parameters:
filename - full path to index file- Returns:
- true if the file is there and readable
getIndexFilename
protected static String getIndexFilename(String tablename,
String columnname)
Return an appropriate filename for an index of the specified
column of the specified table. This method will generate a
single character hash code ([A-P]) for the index and return
a filename like:
/data/index/C/table.column
Note:
- /data/index is the base index directory
- C is the computed hash code
- table is the name of the table
- column is the name of the column
This method will ensure that the directory where the index
data will be stored exists.
- Parameters:
tablename - name of table to indexcolumnname - name of column to index- Returns:
- full qualified path name where index data should be stored