|
Elexis: Das führende OpenSource-Arztpraxisprogamm im deutschsprachigen Raum Java doc für Elexis version 2.1.7.dev vom 01.09.2013 |
||||||||
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 | |
---|---|
static class |
Table.ColumnOrder
enum which controls the ordering of the columns in a table. |
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 |
Constructor Summary | |
---|---|
protected |
Table(Database database,
java.nio.ByteBuffer tableBuffer,
int pageNumber,
java.lang.String name,
int flags,
boolean useBigIndex)
|
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,?> 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,?> 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)
|
int |
getApproximateOwnedPageCount()
Returns the approximate number of database pages owned by this table and all related indexes (this number does not take into account pages used for large OLE/MEMO fields). |
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 ). |
Index |
getForeignKeyIndex(Table otherTable)
|
JetFormat |
getFormat()
|
Index |
getIndex(java.lang.String name)
|
java.util.List<Index> |
getIndexes()
|
protected TempPageHolder |
getLongValueBuffer()
|
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)
|
protected UsageMap.PageCursor |
getOwnedPagesCursor()
|
PageChannel |
getPageChannel()
|
Index |
getPrimaryKeyIndex()
|
PropertyMap |
getProperties()
|
protected PropertyMaps |
getPropertyMaps()
|
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. |
int |
getTableDefPageNumber()
|
static boolean |
isDeletedRow(short rowStart)
|
boolean |
isHidden()
Whether or not this table has been marked as hidden. |
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 a modifiable 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 a modifiable 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, see Cursor.reset() . |
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. |
protected static void |
writeTableDefinition(com.healthmarketscience.jackcess.TableCreator creator)
Writes a new table defined by the given TableCreator to the database. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final byte TYPE_SYSTEM
public static final byte TYPE_USER
Constructor Detail |
---|
protected Table(Database database, java.nio.ByteBuffer tableBuffer, int pageNumber, java.lang.String name, int flags, boolean useBigIndex) throws java.io.IOException
database
- database which owns this tabletableBuffer
- Buffer to read the table withpageNumber
- Page number of the table definitionname
- Table nameuseBigIndex
- whether or not "big index support" should be enabled for the table
java.io.IOException
Method Detail |
---|
public java.lang.String getName()
public boolean isHidden()
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 int getTableDefPageNumber()
public Table.RowState createRowState()
protected UsageMap.PageCursor getOwnedPagesCursor()
public int getApproximateOwnedPageCount()
To calculate the approximate number of bytes owned by a table:
int approxTableBytes = (table.getApproximateOwnedPageCount() *
table.getFormat().PAGE_SIZE);
protected TempPageHolder getLongValueBuffer()
public java.util.List<Column> getColumns()
public Column getColumn(java.lang.String name)
public PropertyMap getProperties() throws java.io.IOException
java.io.IOException
protected PropertyMaps getPropertyMaps() throws java.io.IOException
java.io.IOException
public java.util.List<Index> getIndexes()
public Index getIndex(java.lang.String name)
java.lang.IllegalArgumentException
- if there is no index with the given namepublic Index getPrimaryKeyIndex()
java.lang.IllegalArgumentException
- if there is no primary key index on this tablepublic Index getForeignKeyIndex(Table otherTable)
java.lang.IllegalArgumentException
- if there is no relationship between this table and the given tablepublic void reset()
Cursor.reset()
.
public void deleteCurrentRow() throws java.io.IOException
getNextRow()
).
java.io.IOException
public void deleteRow(Table.RowState rowState, RowId rowId) throws java.io.IOException
Note, this method is not generally meant to be used directly. You should use the
deleteCurrentRow()
method or use the Cursor class, which allows for more complex table
interactions.
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
Note, this method is not generally meant to be used directly. Instead use the Cursor class,
which allows for more complex table interactions, e.g. Cursor.getCurrentRowValue(com.healthmarketscience.jackcess.Column)
.
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 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
.
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 a modifiable 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 withinprotected static void writeTableDefinition(com.healthmarketscience.jackcess.TableCreator creator) throws java.io.IOException
java.io.IOException
public java.lang.Object[] asRow(java.util.Map<java.lang.String,?> rowMap)
addRow(Object...)
.
public java.lang.Object[] asUpdateRow(java.util.Map<java.lang.String,?> 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
Note, this method is not generally meant to be used directly. You should use the
updateCurrentRow(java.lang.Object...)
method or use the Cursor class, which allows for more complex table
interactions, e.g. Cursor.setCurrentRowValue(com.healthmarketscience.jackcess.Column, java.lang.Object)
and Cursor.updateCurrentRow(java.lang.Object...)
.
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: Das führende OpenSource-Arztpraxisprogamm im deutschsprachigen Raum Java doc für Elexis version 2.1.7.dev vom 01.09.2013 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |