|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface Table
A single database table. A Table instance is retrieved from a Database instance. The Table instance provides access to the table
metadata as well as the table data. There are basic data operations on the
Table interface (i.e. iterator() addRow(java.lang.Object...), updateRow(com.healthmarketscience.jackcess.Row)
and deleteRow(com.healthmarketscience.jackcess.Row)), but for advanced search and data manipulation a
Cursor instance should be used. New Tables can be created using a
TableBuilder. The Joiner utility can be used to traverse
table relationships (e.g. find rows in another table based on a foreign-key
relationship).
Database for more
thread-safety details).
| Nested Class Summary | |
|---|---|
static class |
Table.ColumnOrder
enum which controls the ordering of the columns in a table. |
| Method Summary | ||
|---|---|---|
Object[] |
addRow(Object... row)
Adds a single row to this table and writes it to disk. |
|
|
addRowFromMap(M row)
Calls asRow(java.util.Map on the given row map and passes the result to addRow(java.lang.Object...). |
|
List<? extends Object[]> |
addRows(List<? extends Object[]> rows)
Add multiple rows to this table, only writing to disk after all rows have been written, and every time a data page is filled. |
|
|
addRowsFromMaps(List<M> rows)
Calls asRow(java.util.Map on the given row maps and passes the results to
addRows(java.util.List extends java.lang.Object[]>). |
|
Object[] |
asRow(Map<String,?> rowMap)
Converts a map of columnName -> columnValue to an array of row values appropriate for a call to addRow(Object...). |
|
Object[] |
asUpdateRow(Map<String,?> rowMap)
Converts a map of columnName -> columnValue to an array of row values appropriate for a call to Cursor.updateCurrentRow(Object...). |
|
Row |
deleteRow(Row row)
Delete the given row. |
|
Column |
getColumn(String name)
|
|
int |
getColumnCount()
|
|
List<? extends Column> |
getColumns()
|
|
Database |
getDatabase()
|
|
Cursor |
getDefaultCursor()
|
|
ErrorHandler |
getErrorHandler()
Gets the currently configured ErrorHandler (always non- null). |
|
Index |
getForeignKeyIndex(Table otherTable)
|
|
Index |
getIndex(String name)
|
|
List<? extends Index> |
getIndexes()
|
|
String |
getName()
|
|
Row |
getNextRow()
|
|
Index |
getPrimaryKeyIndex()
|
|
PropertyMap |
getProperties()
|
|
int |
getRowCount()
|
|
boolean |
isHidden()
Whether or not this table has been marked as hidden. |
|
Iterator<Row> |
iterator()
Calls reset() on this table and returns a modifiable
Iterator which will iterate through all the rows of this table. |
|
CursorBuilder |
newCursor()
Convenience method for constructing a new CursorBuilder for this Table. |
|
void |
reset()
After calling this method, getNextRow() will return the first row
in the table, see Cursor.reset() (uses the default cursor). |
|
void |
setErrorHandler(ErrorHandler newErrorHandler)
Sets a new ErrorHandler. |
|
Row |
updateRow(Row row)
Update the given row. |
|
| Method Detail |
|---|
String getName()
boolean isHidden()
int getColumnCount()
Database getDatabase()
ErrorHandler getErrorHandler()
null).
This will be used to handle all errors unless overridden at the Cursor
level.
void setErrorHandler(ErrorHandler newErrorHandler)
null, resets to using the
ErrorHandler configured at the Database level.
List<? extends Column> getColumns()
Column getColumn(String name)
PropertyMap getProperties()
throws IOException
IOExceptionList<? extends Index> getIndexes()
Index getIndex(String name)
IllegalArgumentException - if there is no index with the given nameIndex getPrimaryKeyIndex()
IllegalArgumentException - if there is no primary key index on this
tableIndex getForeignKeyIndex(Table otherTable)
IllegalArgumentException - if there is no relationship between this
table and the given tableObject[] asRow(Map<String,?> rowMap)
addRow(Object...).
Object[] asUpdateRow(Map<String,?> rowMap)
Cursor.updateCurrentRow(Object...).
int getRowCount()
Object[] addRow(Object... row)
throws IOException
getColumns() method. This is by default the storage order of the
Columns in the database, however this order can be influenced by setting
the ColumnOrder via Database.setColumnOrder(com.healthmarketscience.jackcess.Table.ColumnOrder) prior to opening
the Table. The asRow(java.util.Map) method can be used to easily convert a row
Map into the appropriate row array for this Table.
Note, if this table has an auto-number column, the value generated will be put back into the given row array (assuming the given row array is at least as long as the number of Columns in this Table).
row - row values for a single row. the given row array will be
modified if this table contains an auto-number column,
otherwise it will not be modified.
IOException
<M extends Map<String,Object>> M addRowFromMap(M row)
throws IOException
asRow(java.util.Map) on the given row map and passes the result to addRow(java.lang.Object...).
Note, if this table has an auto-number column, the value generated will be
put back into the given row map.
IOException
List<? extends Object[]> addRows(List<? extends Object[]> rows)
throws IOException
addRow(java.lang.Object...) multiple times.
Note, if this table has an auto-number column, the values written will be put back into the given row arrays (assuming the given row array is at least as long as the number of Columns in this Table).
rows - List of Object[] row values. the rows will be modified if
this table contains an auto-number column, otherwise they
will not be modified.
IOExceptionfor more details on row arrays
<M extends Map<String,Object>> List<M> addRowsFromMaps(List<M> rows)
throws IOException
asRow(java.util.Map) on the given row maps and passes the results to
addRows(java.util.List extends java.lang.Object[]>).
Note, if this table has an auto-number column, the values generated will
be put back into the appropriate row maps.
IOException
Row updateRow(Row row)
throws IOException
IllegalStateException - if the given row is not valid, or deleted.
IOException
Row deleteRow(Row row)
throws IOException
IllegalStateException - if the given row is not valid
IOExceptionIterator<Row> iterator()
reset() on this table and returns a modifiable
Iterator which will iterate through all the rows of this table. Use of
the Iterator follows the same restrictions as a call to
getNextRow().
For more advanced iteration, use the default
cursor directly.
iterator in interface Iterable<Row>RuntimeIOException - if an IOException is thrown by one of the
operations, the actual exception will be contained withinvoid reset()
getNextRow() will return the first row
in the table, see Cursor.reset() (uses the default cursor).
Row getNextRow()
throws IOException
default cursor)
IOExceptionCursor getDefaultCursor()
CursorBuilder newCursor()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||