|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object
|
+--ModSQL.IndexTable
|
+--ModSQL.IndexTable_Sort
Implementation of DatabaseTable for tables that are indexed by the ModSQL driver.
This index can be accessed just as the original table is accessed. Access to the column that is indexed will be fast while access to other columns will be slower as data must be loaded from the original table.
| Field Summary | |
protected boolean |
after_last
|
protected boolean |
before_first
|
protected BufferedInputStream |
buffer
|
protected static int |
BUFFERSIZE
|
protected int |
columnindex
|
protected int |
columntype
|
protected long |
current_count
|
protected int |
current_entry
|
protected int |
current_index
|
protected IndexTableEntry[] |
entries
|
protected int |
entries_to_read
|
protected FileInputStream |
file
|
protected ObjectInputStream |
istream
|
protected DatabaseTable |
table
|
protected static int |
TYPE
|
protected static int |
VERSION
|
| Constructor Summary | |
IndexTable_Sort(DatabaseTable table,
String filename)
Constructor. |
|
| Method Summary | |
void |
afterLast()
Moves the table cursor to a position after the last row in the table. |
void |
beforeFirst()
Moves the table cursor to a position before the first row in the table. |
void |
close()
In some cases, it is desirable to immediately release a DatabaseTable's database and other resources instead of waiting for this to happen when it is automatically closed; the close method provides this immediate release. |
void |
commitUpdates()
ModSQL will always call this method after performing a series of updateObject() calls on a particular row. |
(package private) static void |
createIndex(DatabaseManager tablemanager,
String tablename,
int columnindex)
Create new index. |
(package private) static void |
createIndex(DatabaseManager tablemanager,
String tablename,
String columnname)
Create new index. |
(package private) static void |
createIndex(DatabaseTable table,
int columnindex)
Create new index. |
void |
deleteRow()
Delete the current row from the table and the underlying database. |
protected void |
finalize()
Close index. |
boolean |
findNext(int column,
Object data)
Old version of findNext() above that requires a column index. |
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. |
Object |
getObject(int column)
Get the value of a column in the current row as a Java object. |
long |
getRowCount()
This method is expected to return the total number of rows in the database. |
Object |
getRowId()
Get database specific rowid value. |
boolean |
isAfterLast()
Determine if the table cursor is positioned after the last row in the table. |
boolean |
isBeforeFirst()
Determine if the table cursor is positioned before the first row in the table. |
boolean |
next()
A DatabaseTable is initially positioned before its first row; the first call to next makes the first row the current row; the second call makes the second row the current row, etc. |
void |
updateObject(int column,
Object x)
Update a column with an Object value. |
| Methods inherited from class ModSQL.IndexTable |
getIndexFilename, isIndexAvailable, openIndex |
| Methods inherited from class java.lang.Object |
|
| Field Detail |
protected static final int TYPE
protected static final int VERSION
protected static final int BUFFERSIZE
protected FileInputStream file
protected BufferedInputStream buffer
protected ObjectInputStream istream
protected DatabaseTable table
protected int columnindex
protected int columntype
protected IndexTableEntry[] entries
protected int entries_to_read
protected boolean before_first
protected boolean after_last
protected int current_entry
protected int current_index
protected long current_count
| Constructor Detail |
public IndexTable_Sort(DatabaseTable table,
String filename)
throws DatabaseException
table - open table to indexfilename - path to index fileDatabaseException - if there is a problem with the index| Method Detail |
protected void finalize()
finalize in class Objectpublic final void close()
DatabaseTableBaseIn some cases, it is desirable to immediately release a DatabaseTable's database and other resources instead of waiting for this to happen when it is automatically closed; the close method provides this immediate release.
Note: A DatabaseTable is automatically closed by the Statement that generated it when that Statement is closed, re-executed, or is used to retrieve the next result from a sequence of multiple results. A DatabaseTable is also automatically closed when it is garbage collected.
ModSQL.DatabaseTableBaseDatabaseException - if a database-access error occurspublic long getRowCount()
DatabaseTableBaseModSQL.DatabaseTableBaseDatabaseException - if a database-access error occurspublic long getDistinctCount()
DatabaseIndexModSQL.DatabaseIndexDatabaseException - if a database-access error occurspublic long getNullCount()
DatabaseIndexModSQL.DatabaseIndexDatabaseException - if a database-access error occurs
public boolean next()
throws DatabaseException
DatabaseTableBaseModSQL.DatabaseTableBaseDatabaseException - if a database-access error occurs
public boolean findNext(Object data)
throws DatabaseException
DatabaseIndexModSQL.DatabaseIndexdata - desired dataDatabaseException - if a database-access error occurs
public boolean findNext(int column,
Object data)
throws DatabaseException
DatabaseException - if there is a problem with the index
public void deleteRow()
throws DatabaseException
DatabaseTableBaseModSQL.DatabaseTableBaseDatabaseException - if a database-access error occurspublic boolean isBeforeFirst()
DatabaseTableBaseModSQL.DatabaseTableBaseDatabaseException - if a database-access error occurspublic boolean isAfterLast()
DatabaseTableBaseModSQL.DatabaseTableBaseDatabaseException - if a database-access error occurs
public void beforeFirst()
throws DatabaseException
DatabaseTableBaseModSQL.DatabaseTableBaseDatabaseException - if a database-access error occurs
public void afterLast()
throws DatabaseException
DatabaseTableBaseModSQL.DatabaseTableBaseDatabaseException - if a database-access error occurs
public Object getRowId()
throws DatabaseException
DatabaseTableBaseModSQL.DatabaseTableBaseDatabaseException - if a database-access error occurs
public Object getObject(int column)
throws DatabaseException
DatabaseTableBaseGet the value of a column in the current row as a Java object.
This method will return the value of the given column as a Java object. The type of the Java object will be the default Java Object type corresponding to the column's SQL type, following the mapping specified in the JDBC spec.
This method may also be used to read datatabase specific abstract data types.
ModSQL.DatabaseTableBasecolumn - the first column is 1, the second is 2, ...DatabaseException - if a database-access error occurs
public void updateObject(int column,
Object x)
throws DatabaseException
DatabaseTableBaseUpdate a column with an Object value.
The updateObject() method is used to update column values in the current row, or a newly inserted row.
ModSQL.DatabaseTableBasecolumn - the first column is 1, the second is 2, ...x - the new column valueDatabaseException - if a database-access error occurs
public void commitUpdates()
throws DatabaseException
DatabaseTableBaseModSQL.DatabaseTableBaseDatabaseException - if a database-access error occurs
static void createIndex(DatabaseManager tablemanager,
String tablename,
String columnname)
throws SQLException
tablemanager - active table managertablename - name of table to indexcolumnname - name of column to indexSQLException - if there is a problem creating the index
static void createIndex(DatabaseManager tablemanager,
String tablename,
int columnindex)
throws SQLException
tablemanager - active table managertablename - name of table to indexcolumnindex - index of column to indexSQLException - if there is a problem creating the index
static void createIndex(DatabaseTable table,
int columnindex)
throws SQLException
table - open table to indexcolumnindex - index of column to indexSQLException - if there is a problem creating the index
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||