|
Elexis API documentationVersion 2.1.6 as of December 11 2011 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.healthmarketscience.jackcess.Table
public class Table
A single database table
Is not thread-safe.
Nested Class Summary | |
---|---|
class |
Table.RowState
Maintains the state of reading a row of data. |
Field Summary | |
---|---|
static byte |
TYPE_SYSTEM
Table type code for system tables |
static byte |
TYPE_USER
Table type code for user tables |
Method Summary | |
---|---|
static int |
addDataPageRow(java.nio.ByteBuffer dataPage,
int rowSize,
JetFormat format,
int rowFlags)
Updates free space and row info for a new row of the given size in the given data page. |
void |
addRow(java.lang.Object... row)
Add a single row to this table and write it to disk Note, if this table has an auto-number column, the value written will be put back into the given row array. |
void |
addRows(java.util.List<? extends java.lang.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. |
java.lang.Object[] |
asRow(java.util.Map<java.lang.String,java.lang.Object> rowMap)
Converts a map of columnName -> columnValue to an array of row values appropriate for a call to addRow(Object...) . |
java.lang.Object[] |
asUpdateRow(java.util.Map<java.lang.String,java.lang.Object> rowMap)
Converts a map of columnName -> columnValue to an array of row values appropriate for a call to updateCurrentRow(Object...) . |
static short |
cleanRowStart(short rowStart)
|
Table.RowState |
createRowState()
|
void |
deleteCurrentRow()
Delete the current row (retrieved by a call to getNextRow() ). |
void |
deleteRow(Table.RowState rowState,
RowId rowId)
Delete the row on which the given rowState is currently positioned. |
java.lang.String |
display()
|
java.lang.String |
display(long limit)
|
boolean |
doUseBigIndex()
|
static short |
findRowEnd(java.nio.ByteBuffer buffer,
int rowNum,
JetFormat format)
|
static short |
findRowStart(java.nio.ByteBuffer buffer,
int rowNum,
JetFormat format)
|
static java.util.List<Column> |
getAutoNumberColumns(java.util.Collection<Column> columns)
|
Column |
getColumn(java.lang.String name)
|
int |
getColumnCount()
|
java.util.List<Column> |
getColumns()
|
Database |
getDatabase()
|
ErrorHandler |
getErrorHandler()
Gets the currently configured ErrorHandler (always non- null ). |
JetFormat |
getFormat()
|
Index |
getIndex(java.lang.String name)
|
java.util.List<Index> |
getIndexes()
|
int |
getMaxColumnCount()
|
java.lang.String |
getName()
|
java.util.Map<java.lang.String,java.lang.Object> |
getNextRow()
|
java.util.Map<java.lang.String,java.lang.Object> |
getNextRow(java.util.Collection<java.lang.String> columnNames)
|
PageChannel |
getPageChannel()
|
java.util.Map<java.lang.String,java.lang.Object> |
getRow(Table.RowState rowState,
RowId rowId,
java.util.Collection<java.lang.String> columnNames)
Reads some columns from the given row. |
int |
getRowCount()
|
static int |
getRowEndOffset(int rowNum,
JetFormat format)
|
static int |
getRowSpaceUsage(int rowSize,
JetFormat format)
|
static int |
getRowStartOffset(int rowNum,
JetFormat format)
|
java.lang.Object |
getRowValue(Table.RowState rowState,
RowId rowId,
Column column)
Reads a single column from the given row. |
static boolean |
isDeletedRow(short rowStart)
|
static boolean |
isOverflowRow(short rowStart)
|
java.util.Iterator<java.util.Map<java.lang.String,java.lang.Object>> |
iterator()
Calls reset on this table and returns an unmodifiable Iterator which will
iterate through all the rows of this table. |
java.util.Iterator<java.util.Map<java.lang.String,java.lang.Object>> |
iterator(java.util.Collection<java.lang.String> columnNames)
Calls reset on this table and returns an unmodifiable Iterator which will
iterate through all the rows of this table, returning only the given columns. |
static java.nio.ByteBuffer |
positionAtRowData(Table.RowState rowState,
RowId rowId)
Sets the position and limit in a new buffer using the given rowState according to the given row number and row end, following overflow row pointers as necessary. |
static java.nio.ByteBuffer |
positionAtRowHeader(Table.RowState rowState,
RowId rowId)
Sets a new buffer to the correct row header page using the given rowState according to the given rowId. |
void |
reset()
After calling this method, getNextRow will return the first row in the table |
static boolean |
rowFitsOnDataPage(int rowLength,
java.nio.ByteBuffer dataPage,
JetFormat format)
Returns true if a row of the given size will fit on the given data page, false otherwise. |
void |
setErrorHandler(ErrorHandler newErrorHandler)
Sets a new ErrorHandler. |
java.lang.String |
toString()
|
void |
updateCurrentRow(java.lang.Object... row)
Updates the current row to the new values. |
void |
updateRow(Table.RowState rowState,
RowId rowId,
java.lang.Object... row)
Update the row on which the given rowState is currently positioned. |
static int |
writeTableDefinition(java.util.List<Column> columns,
PageChannel pageChannel,
JetFormat format,
java.nio.charset.Charset charset)
Writes a new table defined by the given columns to the database. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final byte TYPE_SYSTEM
public static final byte TYPE_USER
Method Detail |
---|
public java.lang.String getName()
public boolean doUseBigIndex()
public int getMaxColumnCount()
public int getColumnCount()
public Database getDatabase()
public JetFormat getFormat()
public PageChannel getPageChannel()
public ErrorHandler getErrorHandler()
null
). This will be used to
handle all errors unless overridden at the Cursor level.
public void setErrorHandler(ErrorHandler newErrorHandler)
null
, resets to using the ErrorHandler configured at the
Database level.
public Table.RowState createRowState()
public java.util.List<Column> getColumns()
public Column getColumn(java.lang.String name)
public java.util.List<Index> getIndexes()
public Index getIndex(java.lang.String name)
public void reset()
public void deleteCurrentRow() throws java.io.IOException
getNextRow()
).
java.io.IOException
public void deleteRow(Table.RowState rowState, RowId rowId) throws java.io.IOException
java.io.IOException
public java.util.Map<java.lang.String,java.lang.Object> getNextRow() throws java.io.IOException
java.io.IOException
public java.util.Map<java.lang.String,java.lang.Object> getNextRow(java.util.Collection<java.lang.String> columnNames) throws java.io.IOException
columnNames
- Only column names in this collection will be returned
java.io.IOException
public java.lang.Object getRowValue(Table.RowState rowState, RowId rowId, Column column) throws java.io.IOException
java.io.IOException
public java.util.Map<java.lang.String,java.lang.Object> getRow(Table.RowState rowState, RowId rowId, java.util.Collection<java.lang.String> columnNames) throws java.io.IOException
columnNames
- Only column names in this collection will be returned
java.io.IOException
public static java.nio.ByteBuffer positionAtRowHeader(Table.RowState rowState, RowId rowId) throws java.io.IOException
java.io.IOException
public static java.nio.ByteBuffer positionAtRowData(Table.RowState rowState, RowId rowId) throws java.io.IOException
java.io.IOException
public java.util.Iterator<java.util.Map<java.lang.String,java.lang.Object>> iterator()
reset
on this table and returns an unmodifiable Iterator which will
iterate through all the rows of this table. Use of the Iterator follows the same restrictions
as a call to getNextRow
.
iterator
in interface java.lang.Iterable<java.util.Map<java.lang.String,java.lang.Object>>
java.lang.IllegalStateException
- if an IOException is thrown by one of the operations, the actual exception will
be contained withinpublic java.util.Iterator<java.util.Map<java.lang.String,java.lang.Object>> iterator(java.util.Collection<java.lang.String> columnNames)
reset
on this table and returns an unmodifiable Iterator which will
iterate through all the rows of this table, returning only the given columns. Use of the
Iterator follows the same restrictions as a call to getNextRow
.
java.lang.IllegalStateException
- if an IOException is thrown by one of the operations, the actual exception will
be contained withinpublic static int writeTableDefinition(java.util.List<Column> columns, PageChannel pageChannel, JetFormat format, java.nio.charset.Charset charset) throws java.io.IOException
java.io.IOException
public java.lang.Object[] asRow(java.util.Map<java.lang.String,java.lang.Object> rowMap)
addRow(Object...)
.
public java.lang.Object[] asUpdateRow(java.util.Map<java.lang.String,java.lang.Object> rowMap)
updateCurrentRow(Object...)
.
public void addRow(java.lang.Object... row) throws java.io.IOException
Note, if this table has an auto-number column, the value written will be put back into the given row array.
row
- row values for a single row. the row will be modified if this table contains an
auto-number column, otherwise it will not be modified.
java.io.IOException
public void addRows(java.util.List<? extends java.lang.Object[]> rows) throws java.io.IOException
addRow
multiple times.
Note, if this table has an auto-number column, the values written will be put back into the given row arrays.
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.
java.io.IOException
public void updateCurrentRow(java.lang.Object... row) throws java.io.IOException
Note, if this table has an auto-number column(s), the existing value(s) will be maintained, unchanged.
row
- new row values for the current row.
java.io.IOException
public void updateRow(Table.RowState rowState, RowId rowId, java.lang.Object... row) throws java.io.IOException
java.io.IOException
public int getRowCount()
public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String display() throws java.io.IOException
java.io.IOException
public java.lang.String display(long limit) throws java.io.IOException
limit
- Maximum number of rows to display
java.io.IOException
public static int addDataPageRow(java.nio.ByteBuffer dataPage, int rowSize, JetFormat format, int rowFlags)
public static boolean isDeletedRow(short rowStart)
public static boolean isOverflowRow(short rowStart)
public static short cleanRowStart(short rowStart)
public static short findRowStart(java.nio.ByteBuffer buffer, int rowNum, JetFormat format)
public static int getRowStartOffset(int rowNum, JetFormat format)
public static short findRowEnd(java.nio.ByteBuffer buffer, int rowNum, JetFormat format)
public static int getRowEndOffset(int rowNum, JetFormat format)
public static int getRowSpaceUsage(int rowSize, JetFormat format)
public static java.util.List<Column> getAutoNumberColumns(java.util.Collection<Column> columns)
public static boolean rowFitsOnDataPage(int rowLength, java.nio.ByteBuffer dataPage, JetFormat format) throws java.io.IOException
true
if a row of the given size will fit on the given data page, false
otherwise.
java.io.IOException
|
Elexis API documentationVersion 2.1.6 as of December 11 2011 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |