|
|||||||||
| 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(ByteBuffer dataPage,
int rowSize,
JetFormat format)
Updates free space and row info for a new row of the given size in the given data page. |
void |
addRow(Object... row)
Add a single row to this table and write it to disk |
void |
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. |
Object[] |
asRow(Map<String,Object> rowMap)
Converts a map of columnName -> columnValue to an array of row values appropriate for a call to addRow(Object...). |
static short |
cleanRowStart(short rowStart)
|
static int |
countAutoNumberColumns(Collection<Column> columns)
|
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. |
String |
display()
|
String |
display(long limit)
|
boolean |
doUseBigIndex()
|
static short |
findRowEnd(ByteBuffer buffer,
int rowNum,
JetFormat format)
|
static short |
findRowStart(ByteBuffer buffer,
int rowNum,
JetFormat format)
|
Column |
getColumn(String name)
|
int |
getColumnCount()
|
List<Column> |
getColumns()
|
Database |
getDatabase()
|
JetFormat |
getFormat()
|
Index |
getIndex(String name)
|
List<Index> |
getIndexes()
|
int |
getMaxColumnCount()
|
String |
getName()
|
Map<String,Object> |
getNextRow()
|
Map<String,Object> |
getNextRow(Collection<String> columnNames)
|
PageChannel |
getPageChannel()
|
Map<String,Object> |
getRow(Table.RowState rowState,
RowId rowId,
Collection<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)
|
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)
|
Iterator<Map<String,Object>> |
iterator()
Calls reset on this table and returns an unmodifiable
Iterator which will iterate through all the rows of this table. |
Iterator<Map<String,Object>> |
iterator(Collection<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 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 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 |
String |
toString()
|
static int |
writeTableDefinition(List<Column> columns,
PageChannel pageChannel,
JetFormat format)
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 String getName()
public boolean doUseBigIndex()
public int getMaxColumnCount()
public int getColumnCount()
public Database getDatabase()
public JetFormat getFormat()
public PageChannel getPageChannel()
public Table.RowState createRowState()
public List<Column> getColumns()
public Column getColumn(String name)
public List<Index> getIndexes()
public Index getIndex(String name)
public void reset()
public void deleteCurrentRow()
throws IOException
getNextRow()).
IOException
public void deleteRow(Table.RowState rowState,
RowId rowId)
throws IOException
IOException
public Map<String,Object> getNextRow()
throws IOException
IOException
public Map<String,Object> getNextRow(Collection<String> columnNames)
throws IOException
columnNames - Only column names in this collection will be returned
IOException
public Object getRowValue(Table.RowState rowState,
RowId rowId,
Column column)
throws IOException
IOException
public Map<String,Object> getRow(Table.RowState rowState,
RowId rowId,
Collection<String> columnNames)
throws IOException
columnNames - Only column names in this collection will be returned
IOException
public static ByteBuffer positionAtRowHeader(Table.RowState rowState,
RowId rowId)
throws IOException
IOException
public static ByteBuffer positionAtRowData(Table.RowState rowState,
RowId rowId)
throws IOException
IOExceptionpublic Iterator<Map<String,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 Iterable<Map<String,Object>>IllegalStateException - if an IOException is thrown by one of the
operations, the actual exception will be contained withinpublic Iterator<Map<String,Object>> iterator(Collection<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.
IllegalStateException - if an IOException is thrown by one of the
operations, the actual exception will be contained within
public static int writeTableDefinition(List<Column> columns,
PageChannel pageChannel,
JetFormat format)
throws IOException
IOExceptionpublic Object[] asRow(Map<String,Object> rowMap)
addRow(Object...).
public void addRow(Object... row)
throws 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.
IOException
public void addRows(List<? extends Object[]> rows)
throws 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.
IOExceptionpublic int getRowCount()
public String toString()
toString in class Object
public String display()
throws IOException
IOException
public String display(long limit)
throws IOException
limit - Maximum number of rows to display
IOException
public static int addDataPageRow(ByteBuffer dataPage,
int rowSize,
JetFormat format)
public static boolean isDeletedRow(short rowStart)
public static boolean isOverflowRow(short rowStart)
public static short cleanRowStart(short rowStart)
public static short findRowStart(ByteBuffer buffer,
int rowNum,
JetFormat format)
public static int getRowStartOffset(int rowNum,
JetFormat format)
public static short findRowEnd(ByteBuffer buffer,
int rowNum,
JetFormat format)
public static int getRowEndOffset(int rowNum,
JetFormat format)
public static int getRowSpaceUsage(int rowSize,
JetFormat format)
public static int countAutoNumberColumns(Collection<Column> columns)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||