APIdia Launch Partner
Top Description Inners Methods
io.github.spannm.jackcess

public Interface Table

extends Iterable<Row>, TableDefinition
Known Direct Implementers
io.github.spannm.jackcess.impl.TableImpl
Imports
io.github.spannm.jackcess.util.ErrorHandler, .OleBlob, java.io.IOException, .UncheckedIOException, java.time.LocalDateTime, java.util.Iterator, .List, .Map, java.util.stream.Stream, .StreamSupport

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, updateRow and deleteRow), but for advanced search and data manipulation a Cursor instance should be used. New Tables can be created using a TableBuilder. The io.github.spannm.jackcess.util.Joiner utility can be used to traverse table relationships (e.g. find rows in another table based on a foreign-key relationship).

A Table instance is not thread-safe (see Database for more thread-safety details).

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static enum
Table.ColumnOrder

enum which controls the ordering of the columns in a table.

Method Summary

Modifier and TypeMethod and Description
public Object[]

Returns:

the given row values if long enough, otherwise a new array. the returned array will contain any autonumbers generated
addRow
(Object...
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.
row
)

Adds a single row to this table and writes it to disk.

public <M extends Map<String, Object>> M

Returns:

the given row map, which will contain any autonumbers generated
addRowFromMap
(M row)

Calls asRow on the given row map and passes the result to addRow.

public List<? extends Object[]>

Returns:

the given row values list (unless row values were to small), with appropriately sized row values (the ones passed in if long enough). the returned arrays will contain any autonumbers generated
addRows
(List<? extends Object[]>
List of Object[] row values. the rows will be modified if this table contains an auto-number column, otherwise they will not be modified.
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.

public <M extends Map<String, Object>> List<M>

Returns:

the given row map list, where the row maps will contain any autonumbers generated
addRowsFromMaps
(List<M> rows)

Calls asRow on the given row maps and passes the results to addRows.

public Object[]
asRow(Map<String, ?> rowMap)

Converts a map of columnName -> columnValue to an array of row values appropriate for a call to addRow(Object...).

public 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...).

public Row

Returns:

the given row
deleteRow
(Row row)

Delete the given row.

public Column

Returns:

the column with the given name
getColumn
(String name)

Redeclares io.github.spannm.jackcess.TableDefinition.getColumn.

Returns the column with the given name.

public int
getColumnCount()

Redeclares io.github.spannm.jackcess.TableDefinition.getColumnCount.

Returns the number of columns in this table.

public List<? extends Column>

Returns:

All of the columns in this table (unmodifiable List)
getColumns
()

Redeclares io.github.spannm.jackcess.TableDefinition.getColumns.

Returns all of the columns in this table (unmodifiable List).

public LocalDateTime

Returns:

the created date for this table if available
getCreatedDate
()

Redeclares io.github.spannm.jackcess.TableDefinition.getCreatedDate.

Returns the created date for this table if available.

public Database
getDatabase()

Redeclares io.github.spannm.jackcess.TableDefinition.getDatabase.

Returns the database to which this table belongs.

public Cursor

Returns:

a simple Cursor, initialized on demand and held by this table. This cursor backs the row traversal methods available on the Table interface. For advanced Table traversal and manipulation, use the Cursor directly.
getDefaultCursor
()

Returns a simple Cursor, initialized on demand and held by this table.

public ErrorHandler
getErrorHandler()

Gets the currently configured ErrorHandler (always non-null).

public Index

Returns:

the foreign key index joining this table to the given other table
getForeignKeyIndex
(Table otherTable)

Redeclares io.github.spannm.jackcess.TableDefinition.getForeignKeyIndex.

Returns the foreign key index joining this table to the given other table.

public Index

Returns:

the index with the given name
getIndex
(String name)

Redeclares io.github.spannm.jackcess.TableDefinition.getIndex.

Returns the index with the given name.

public List<? extends Index>

Returns:

All of the Indexes on this table (unmodifiable List)
getIndexes
()

Redeclares io.github.spannm.jackcess.TableDefinition.getIndexes.

Returns all of the Indexes on this table (unmodifiable List).

public String

Returns:

The name of the table
getName
()

Redeclares io.github.spannm.jackcess.TableDefinition.getName.

Returns the name of the table.

public Row

Returns:

The next row in this table (Column name -> Column value) (uses the default cursor)
getNextRow
()

Returns the next row in this table (Column name -> Column value) (uses the default cursor).

public Index

Returns:

the primary key index for this table
getPrimaryKeyIndex
()

Redeclares io.github.spannm.jackcess.TableDefinition.getPrimaryKeyIndex.

Returns the primary key index for this table.

public PropertyMap

Returns:

the properties for this table
getProperties
()

Redeclares io.github.spannm.jackcess.TableDefinition.getProperties.

Returns the properties for this table.

public int

Returns:

the number of rows currently stored in this table
getRowCount
()

Returns the number of rows currently stored in this table.

public LocalDateTime

Returns:

the last updated date for this table if available
getUpdatedDate
()

Redeclares io.github.spannm.jackcess.TableDefinition.getUpdatedDate.

Note

jackcess does not automatically update the modified date of a Table.

public boolean
isAllowAutoNumberInsert()

Gets the currently configured auto number insert policy.

public boolean
isHidden()

Redeclares io.github.spannm.jackcess.TableDefinition.isHidden.

Whether or not this table has been marked as hidden.

public boolean
isSystem()

Redeclares io.github.spannm.jackcess.TableDefinition.isSystem.

Whether or not this table is a system (internal) table.

public Iterator<Row>
iterator()

Redeclares java.lang.Iterable.iterator.

Calls reset on this table and returns a modifiable Iterator which will iterate through all the rows of this table.

public default OleBlob.Builder
newBlob()

Convenience method for constructing a new OleBlob.Builder.

public CursorBuilder
newCursor()

Convenience method for constructing a new CursorBuilder for this Table.

public void
reset()

After calling this method, getNextRow will return the first row in the table, see Cursor#reset (uses the default cursor).

public void
setAllowAutoNumberInsert(Boolean allowAutoNumInsert)

Sets the new auto number insert policy for the Table.

public void
setErrorHandler(ErrorHandler newErrorHandler)

Sets a new ErrorHandler.

public default Stream<Row>

Returns:

a Stream using the default Iterator.
stream
()

Returns a Stream using the default Iterator.

public Row

Returns:

the given row, updated with the current row values
updateRow
(Row row)

Update the given row.

Inherited from java.lang.Iterable:
forEachspliterator

Method Detail

addRowback to summary
public Object[] addRow(Object... row) throws IOException

Adds a single row to this table and writes it to disk. The values are expected to be given in the order that the Columns are listed by the 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 prior to opening the Table. The asRow 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).

Parameters
row:Object[]

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.

Returns:Object[]

the given row values if long enough, otherwise a new array. the returned array will contain any autonumbers generated

addRowFromMapback to summary
public <M extends Map<String, Object>> M addRowFromMap(M row) throws IOException

Calls asRow on the given row map and passes the result to addRow.

Note, if this table has an auto-number column, the value generated will be put back into the given row map.

Returns:M

the given row map, which will contain any autonumbers generated

addRowsback to summary
public List<? extends Object[]> addRows(List<? extends Object[]> rows) throws IOException

Add multiple rows to this table, only writing to disk after all rows have been written, and every time a data page is filled. This is much more efficient than calling addRow 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).

Most exceptions thrown from this method will be wrapped with a BatchUpdateException which gives useful information in the case of a partially successful write.

Parameters
rows:List<? extends Object[]>

List of Object[] row values. the rows will be modified if this table contains an auto-number column, otherwise they will not be modified.

Returns:List<? extends Object[]>

the given row values list (unless row values were to small), with appropriately sized row values (the ones passed in if long enough). the returned arrays will contain any autonumbers generated

See Also
{@link #addRow(Object...)} for more details on row arrays
addRowsFromMapsback to summary
public <M extends Map<String, Object>> List<M> addRowsFromMaps(List<M> rows) throws IOException

Calls asRow on the given row maps and passes the results to addRows.

Note, if this table has an auto-number column, the values generated will be put back into the appropriate row maps.

Most exceptions thrown from this method will be wrapped with a BatchUpdateException which gives useful information in the case of a partially successful write.

Returns:List<M>

the given row map list, where the row maps will contain any autonumbers generated

asRowback to summary
public Object[] asRow(Map<String, ?> rowMap)

Converts a map of columnName -> columnValue to an array of row values appropriate for a call to addRow(Object...).

asUpdateRowback to summary
public 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...).

deleteRowback to summary
public Row deleteRow(Row row) throws IOException

Delete the given row. Provided Row must have previously been returned from this Table.

Returns:Row

the given row

Exceptions
IllegalStateException:
if the given row is not valid
getColumnback to summary
public Column getColumn(String name)

Redeclares io.github.spannm.jackcess.TableDefinition.getColumn.

Doc from io.github.spannm.jackcess.TableDefinition.getColumn.

Returns the column with the given name.

Returns:Column

the column with the given name

Annotations
@Override
getColumnCountback to summary
public int getColumnCount()

Redeclares io.github.spannm.jackcess.TableDefinition.getColumnCount.

Doc from io.github.spannm.jackcess.TableDefinition.getColumnCount.

Returns the number of columns in this table.

Annotations
@Override
getColumnsback to summary
public List<? extends Column> getColumns()

Redeclares io.github.spannm.jackcess.TableDefinition.getColumns.

Doc from io.github.spannm.jackcess.TableDefinition.getColumns.

Returns all of the columns in this table (unmodifiable List).

Returns:List<? extends Column>

All of the columns in this table (unmodifiable List)

Annotations
@Override
getCreatedDateback to summary
public LocalDateTime getCreatedDate() throws IOException

Redeclares io.github.spannm.jackcess.TableDefinition.getCreatedDate.

Doc from io.github.spannm.jackcess.TableDefinition.getCreatedDate.

Returns the created date for this table if available.

Returns:LocalDateTime

the created date for this table if available

Annotations
@Override
getDatabaseback to summary
public Database getDatabase()

Redeclares io.github.spannm.jackcess.TableDefinition.getDatabase.

Doc from io.github.spannm.jackcess.TableDefinition.getDatabase.

Returns the database to which this table belongs.

Annotations
@Override
getDefaultCursorback to summary
public Cursor getDefaultCursor()

Returns a simple Cursor, initialized on demand and held by this table. This cursor backs the row traversal methods available on the Table interface. For advanced Table traversal and manipulation, use the Cursor directly.

Returns:Cursor

a simple Cursor, initialized on demand and held by this table. This cursor backs the row traversal methods available on the Table interface. For advanced Table traversal and manipulation, use the Cursor directly.

getErrorHandlerback to summary
public ErrorHandler getErrorHandler()

Gets the currently configured ErrorHandler (always non-null). This will be used to handle all errors unless overridden at the Cursor level.

getForeignKeyIndexback to summary
public Index getForeignKeyIndex(Table otherTable)

Redeclares io.github.spannm.jackcess.TableDefinition.getForeignKeyIndex.

Doc from io.github.spannm.jackcess.TableDefinition.getForeignKeyIndex.

Returns the foreign key index joining this table to the given other table.

Returns:Index

the foreign key index joining this table to the given other table

Annotations
@Override
Exceptions
IllegalArgumentException:
if there is no relationship between this table and the given table
getIndexback to summary
public Index getIndex(String name)

Redeclares io.github.spannm.jackcess.TableDefinition.getIndex.

Doc from io.github.spannm.jackcess.TableDefinition.getIndex.

Returns the index with the given name.

Returns:Index

the index with the given name

Annotations
@Override
Exceptions
IllegalArgumentException:
if there is no index with the given name
getIndexesback to summary
public List<? extends Index> getIndexes()

Redeclares io.github.spannm.jackcess.TableDefinition.getIndexes.

Doc from io.github.spannm.jackcess.TableDefinition.getIndexes.

Returns all of the Indexes on this table (unmodifiable List).

Returns:List<? extends Index>

All of the Indexes on this table (unmodifiable List)

Annotations
@Override
getNameback to summary
public String getName()

Redeclares io.github.spannm.jackcess.TableDefinition.getName.

Doc from io.github.spannm.jackcess.TableDefinition.getName.

Returns the name of the table.

Returns:String

The name of the table

Annotations
@Override
getNextRowback to summary
public Row getNextRow() throws IOException

Returns the next row in this table (Column name -> Column value) (uses the default cursor).

Returns:Row

The next row in this table (Column name -> Column value) (uses the default cursor)

getPrimaryKeyIndexback to summary
public Index getPrimaryKeyIndex()

Redeclares io.github.spannm.jackcess.TableDefinition.getPrimaryKeyIndex.

Doc from io.github.spannm.jackcess.TableDefinition.getPrimaryKeyIndex.

Returns the primary key index for this table.

Returns:Index

the primary key index for this table

Annotations
@Override
Exceptions
IllegalArgumentException:
if there is no primary key index on this table
getPropertiesback to summary
public PropertyMap getProperties() throws IOException

Redeclares io.github.spannm.jackcess.TableDefinition.getProperties.

Doc from io.github.spannm.jackcess.TableDefinition.getProperties.

Returns the properties for this table.

Returns:PropertyMap

the properties for this table

Annotations
@Override
getRowCountback to summary
public int getRowCount()

Returns the number of rows currently stored in this table.

Returns:int

the number of rows currently stored in this table

getUpdatedDateback to summary
public LocalDateTime getUpdatedDate() throws IOException

Redeclares io.github.spannm.jackcess.TableDefinition.getUpdatedDate.

Note

jackcess does not automatically update the modified date of a Table.

Returns:LocalDateTime

the last updated date for this table if available

Annotations
@Override
isAllowAutoNumberInsertback to summary
public boolean isAllowAutoNumberInsert()

Gets the currently configured auto number insert policy.

See Also
Database#isAllowAutoNumberInsert
isHiddenback to summary
public boolean isHidden()

Redeclares io.github.spannm.jackcess.TableDefinition.isHidden.

Whether or not this table has been marked as hidden.

Annotations
@Override
isSystemback to summary
public boolean isSystem()

Redeclares io.github.spannm.jackcess.TableDefinition.isSystem.

Whether or not this table is a system (internal) table.

Annotations
@Override
iteratorback to summary
public Iterator<Row> iterator()

Redeclares java.lang.Iterable.iterator.

Calls 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.

Annotations
@Override
Exceptions
UncheckedIOException:
if an IOException is thrown by one of the operations, the actual exception will be contained within
newBlobback to summary
public default OleBlob.Builder newBlob()

Convenience method for constructing a new OleBlob.Builder.

newCursorback to summary
public CursorBuilder newCursor()

Convenience method for constructing a new CursorBuilder for this Table.

resetback to summary
public void reset()

After calling this method, getNextRow will return the first row in the table, see Cursor#reset (uses the default cursor).

setAllowAutoNumberInsertback to summary
public void setAllowAutoNumberInsert(Boolean allowAutoNumInsert)

Sets the new auto number insert policy for the Table. If null, resets to using the policy configured at the Database level.

setErrorHandlerback to summary
public void setErrorHandler(ErrorHandler newErrorHandler)

Sets a new ErrorHandler. If null, resets to using the ErrorHandler configured at the Database level.

streamback to summary
public default Stream<Row> stream()

Returns a Stream using the default Iterator.

Returns:Stream<Row>

a Stream using the default Iterator.

updateRowback to summary
public Row updateRow(Row row) throws IOException

Update the given row. Provided Row must have previously been returned from this Table.

Returns:Row

the given row, updated with the current row values

Exceptions
IllegalStateException:
if the given row is not valid, or deleted.
io.github.spannm.jackcess back to summary

public final Enum Table.ColumnOrder

extends Enum<Table.ColumnOrder>
Class Inheritance

enum which controls the ordering of the columns in a table.

Field Summary

Modifier and TypeField and Description
public static final Table.ColumnOrder
DATA

columns are ordered based on the order of the data in the table (this order does not change as columns are added to the table).

public static final Table.ColumnOrder
DISPLAY

columns are ordered based on the "display" order (this order can be changed arbitrarily)

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static Table.ColumnOrder
public static Table.ColumnOrder[]
Inherited from java.lang.Enum:
clonecompareTodescribeConstableequalsfinalizegetDeclaringClasshashCodenameordinaltoStringvalueOf

Field Detail

DATAback to summary
public static final Table.ColumnOrder DATA

columns are ordered based on the order of the data in the table (this order does not change as columns are added to the table).

DISPLAYback to summary
public static final Table.ColumnOrder DISPLAY

columns are ordered based on the "display" order (this order can be changed arbitrarily)

Constructor Detail

ColumnOrderback to summary
private ColumnOrder()

Method Detail

valueOfback to summary
public static Table.ColumnOrder valueOf(String name)
valuesback to summary
public static Table.ColumnOrder[] values()