| Modifier and Type | Class and Description |
|---|---|
class |
TableImpl.RowState
Maintains the state of reading/updating a row of data.
|
private static class |
TableImpl.RowStateStatus
the phases the RowState moves through as the data is parsed
|
private static class |
TableImpl.RowStatus
various statuses for the row data
|
protected static class |
TableImpl.WriteRowState
Maintains state for writing a new row of data.
|
Table.ColumnOrder| Modifier and Type | Field and Description |
|---|---|
private TempPageHolder |
_addRowBufferH
page buffer used to update data pages when adding rows
|
private java.lang.Boolean |
_allowAutoNumInsert
optional flag indicating whether or not auto numbers can be directly
inserted by the user
|
private java.util.List<ColumnImpl> |
_autoNumColumns
List of autonumber columns in this table, ordered by column number
|
private java.util.List<ColumnImpl> |
_columns
List of columns in this table, ordered by column number
|
private DatabaseImpl |
_database
owning database
|
private CursorImpl |
_defaultCursor
default cursor for iterating through the table, kept here for basic
table traversal
|
private FKEnforcer |
_fkEnforcer
foreign-key enforcer for this table
|
private int |
_flags
additional table flags from the catalog entry
|
private UsageMap |
_freeSpacePages
Usage map of pages that this table owns with free space on them
|
private java.util.Set<ColumnImpl> |
_indexColumns
List of columns in this table which are in one or more indexes
|
private int |
_indexCount
Number of actual indexes on the table
|
private java.util.List<IndexData> |
_indexDatas
List of index datas on this table (the actual backing data for an
index)
|
private java.util.List<IndexImpl> |
_indexes
List of indexes on this table (multiple logical indexes may be backed by
the same index data)
|
private int |
_lastComplexTypeAutoNumber
last complex type auto number for the table
|
private int |
_lastLongAutoNumber
last long auto number for the table
|
private int |
_logicalIndexCount
Number of logical indexes for the table
|
private TempPageHolder |
_longValueBufferH
page buffer used to write out-of-row "long value" data
|
private short |
_maxColumnCount
max Number of columns in the table (includes previous deletions)
|
private short |
_maxVarColumnCount
max Number of variable columns in the table
|
private int |
_modCount
modification count for the table, keeps row-states up-to-date
|
private java.lang.String |
_name
Table name as stored in Database
|
private UsageMap |
_ownedPages
Usage map of pages that this table owns
|
private PropertyMaps |
_propertyMaps
properties group for this table (and columns)
|
private PropertyMap |
_props
properties for this table
|
private int |
_rowCount
Number of rows in the table
|
private TempPageHolder |
_tableDefBufferH
page buffer used to update the table def page
|
private int |
_tableDefPageNumber
page number of the definition of this table
|
private ErrorHandler |
_tableErrorHandler
optional error handler to use when row errors are encountered
|
private byte |
_tableType
Type of the table (either TYPE_SYSTEM or TYPE_USER)
|
private java.util.List<ColumnImpl> |
_varColumns
List of variable length columns in this table, ordered by offset
|
private TempBufferHolder |
_writeRowBufferH
buffer used to writing rows of data
|
private static short |
DELETED_ROW_MASK |
private static java.util.Comparator<ColumnImpl> |
DISPLAY_ORDER_COMPARATOR
comparator which sorts columns based on their display index
|
private static org.apache.commons.logging.Log |
LOG |
(package private) static int |
MAGIC_TABLE_NUMBER |
private static int |
MAX_BYTE |
private static short |
OFFSET_MASK |
private static short |
OVERFLOW_ROW_MASK |
static byte |
TYPE_SYSTEM
Table type code for system tables
|
static byte |
TYPE_USER
Table type code for user tables
|
private static java.util.Comparator<ColumnImpl> |
VAR_LEN_COLUMN_COMPARATOR
comparator which sorts variable length columns based on their index into
the variable length offset table
|
| Modifier | Constructor and Description |
|---|---|
protected |
TableImpl(boolean testing,
java.util.List<ColumnImpl> columns)
Only used by unit tests
|
protected |
TableImpl(DatabaseImpl database,
java.nio.ByteBuffer tableBuffer,
int pageNumber,
java.lang.String name,
int flags) |
| Modifier and Type | Method and Description |
|---|---|
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.
|
java.lang.Object[] |
addRow(java.lang.Object... row)
Adds a single row to this table and writes it to disk.
|
<M extends java.util.Map<java.lang.String,java.lang.Object>> |
addRowFromMap(M row)
Calls
Table.asRow(java.util.Map<java.lang.String, ?>) on the given row map and passes the result to Table.addRow(java.lang.Object...). |
java.util.List<? extends java.lang.Object[]> |
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.
|
private java.util.List<? extends java.lang.Object[]> |
addRows(java.util.List<? extends java.lang.Object[]> rows,
boolean isBatchWrite)
Add multiple rows to this table, only writing to disk after all
rows have been written, and every time a data page is filled.
|
<M extends java.util.Map<java.lang.String,java.lang.Object>> |
addRowsFromMaps(java.util.List<M> rows)
Calls
Table.asRow(java.util.Map<java.lang.String, ?>) on the given row maps and passes the results to
Table.addRows(java.util.List<? extends java.lang.Object[]>). |
(package private) void |
adjustComplexTypeAutoNumber(int inComplexTypeAutoNumber) |
(package private) void |
adjustLongAutoNumber(int inLongAutoNumber) |
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
Table.addRow(Object...). |
private java.lang.Object[] |
asRow(java.util.Map<java.lang.String,?> rowMap,
java.lang.Object defaultValue,
boolean returnRowId)
Converts a map of columnName -> columnValue to an array of row values.
|
java.lang.Object[] |
asRowWithRowId(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...), where the generated
RowId will be an extra value at the end of the array. |
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
Cursor.updateCurrentRow(Object...). |
static short |
cleanRowStart(short rowStart) |
protected java.nio.ByteBuffer |
createRow(java.lang.Object[] rowArray,
java.nio.ByteBuffer buffer) |
private java.nio.ByteBuffer |
createRow(java.lang.Object[] rowArray,
java.nio.ByteBuffer buffer,
int minRowSize,
java.util.Map<ColumnImpl,byte[]> rawVarValues)
Serialize a row of Objects into a byte buffer.
|
TableImpl.RowState |
createRowState() |
private static void |
createUsageMapDefinitionBuffer(TableCreator creator)
Create the usage map definition page buffer.
|
Row |
deleteRow(Row row)
Delete the given row.
|
RowId |
deleteRow(RowId rowId)
Delete the row with the given id.
|
void |
deleteRow(TableImpl.RowState rowState,
RowIdImpl rowId)
Delete the row for the given rowId.
|
java.lang.String |
display() |
java.lang.String |
display(long limit) |
(package private) static java.lang.Object[] |
dupeRow(java.lang.Object[] row,
int newRowLength)
Duplicates and returns a row of data, optionally with a longer length
filled with
null. |
private java.nio.ByteBuffer |
findFreeRowSpace(int rowSize,
java.nio.ByteBuffer dataPage,
int pageNumber) |
(package private) static java.nio.ByteBuffer |
findFreeRowSpace(UsageMap ownedPages,
UsageMap freeSpacePages,
TempPageHolder rowBufferH) |
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).
|
private void |
getAutoNumberColumns() |
ColumnImpl |
getColumn(java.lang.String name) |
int |
getColumnCount() |
java.util.List<ColumnImpl> |
getColumns() |
DatabaseImpl |
getDatabase() |
CursorImpl |
getDefaultCursor() |
ErrorHandler |
getErrorHandler()
Gets the currently configured ErrorHandler (always non-
null). |
IndexImpl |
getForeignKeyIndex(Table otherTable) |
JetFormat |
getFormat() |
IndexImpl |
getIndex(java.lang.String name) |
java.util.List<IndexData> |
getIndexDatas() |
java.util.List<IndexImpl> |
getIndexes() |
private static java.lang.Object |
getInputAutoNumberRowValue(boolean enableInsert,
ColumnImpl col,
java.lang.Object[] row)
Optionally get the input autonumber row value for the given column from
the given row if one was provided.
|
(package private) int |
getLastComplexTypeAutoNumber() |
(package private) int |
getLastLongAutoNumber() |
int |
getLogicalIndexCount()
Only called by unit tests
|
protected TempPageHolder |
getLongValueBuffer() |
int |
getMaxColumnCount() |
java.lang.String |
getName() |
(package private) int |
getNextComplexTypeAutoNumber() |
(package private) int |
getNextLongAutoNumber() |
Row |
getNextRow() |
UsageMap.PageCursor |
getOwnedPagesCursor() |
PageChannel |
getPageChannel() |
IndexImpl |
getPrimaryKeyIndex() |
PropertyMap |
getProperties() |
PropertyMaps |
getPropertyMaps() |
private static RowImpl |
getRow(JetFormat format,
TableImpl.RowState rowState,
java.nio.ByteBuffer rowBuffer,
java.util.Collection<ColumnImpl> columns,
java.util.Collection<java.lang.String> columnNames)
Reads the row data from the given row buffer.
|
RowImpl |
getRow(TableImpl.RowState rowState,
RowIdImpl rowId,
java.util.Collection<java.lang.String> columnNames)
Reads some columns from the given row.
|
private static java.lang.Object |
getRowColumn(JetFormat format,
java.nio.ByteBuffer rowBuffer,
ColumnImpl column,
TableImpl.RowState rowState,
java.util.Map<ColumnImpl,byte[]> rawVarValues)
Reads the column data from the given row buffer.
|
int |
getRowCount() |
static int |
getRowEndOffset(int rowNum,
JetFormat format) |
RowId |
getRowId(java.lang.Object[] row) |
private NullMask |
getRowNullMask(java.nio.ByteBuffer rowBuffer)
Reads the null mask from the given row buffer.
|
(package private) static int |
getRowsOnDataPage(java.nio.ByteBuffer rowBuffer,
JetFormat format)
Returns the row count for the current page.
|
static int |
getRowSpaceUsage(int rowSize,
JetFormat format) |
static int |
getRowStartOffset(int rowNum,
JetFormat format) |
java.lang.Object |
getRowValue(TableImpl.RowState rowState,
RowIdImpl rowId,
ColumnImpl column)
Reads a single column from the given row.
|
int |
getTableDefPageNumber() |
private void |
handleAutoNumbersForAdd(java.lang.Object[] row,
TableImpl.WriteRowState writeRowState)
Fill in all autonumber column values for add.
|
private void |
handleAutoNumbersForUpdate(java.lang.Object[] row,
java.nio.ByteBuffer rowBuffer,
TableImpl.RowState rowState)
Fill in all autonumber column values for update.
|
boolean |
hasColumn(java.lang.String name) |
boolean |
isAllowAutoNumberInsert()
Gets the currently configured auto number insert policy.
|
static boolean |
isDeletedRow(short rowStart) |
boolean |
isHidden()
Whether or not this table has been marked as hidden.
|
static boolean |
isOverflowRow(short rowStart) |
boolean |
isSystem()
Whether or not this table is a system (internal) table.
|
private static boolean |
isWriteFailure(java.lang.Throwable t) |
java.util.Iterator<Row> |
iterator()
Calls
Table.reset() on this table and returns a modifiable
Iterator which will iterate through all the rows of this table. |
private java.nio.ByteBuffer |
loadCompleteTableDefinitionBuffer(java.nio.ByteBuffer tableBuffer)
Returns a single ByteBuffer which contains the entire table definition
(which may span multiple database pages).
|
CursorBuilder |
newCursor()
Convenience method for constructing a new CursorBuilder for this Table.
|
private java.nio.ByteBuffer |
newDataPage()
Create a new data page
|
private static void |
padRowBuffer(java.nio.ByteBuffer buffer,
int minRowSize,
int trailerSize) |
static java.nio.ByteBuffer |
positionAtRowData(TableImpl.RowState rowState,
RowIdImpl 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(TableImpl.RowState rowState,
RowIdImpl rowId)
Sets a new buffer to the correct row header page using the given rowState
according to the given rowId.
|
private void |
readColumnDefinitions(java.nio.ByteBuffer tableBuffer,
short columnCount) |
private void |
readIndexDefinitions(java.nio.ByteBuffer tableBuffer) |
private static short[] |
readJumpTableVarColOffsets(TableImpl.RowState rowState,
java.nio.ByteBuffer rowBuffer,
int rowStart,
NullMask nullMask) |
private java.lang.String |
readName(java.nio.ByteBuffer buffer)
Returns a name read from the buffer at the current position.
|
private int |
readNameLength(java.nio.ByteBuffer buffer)
Returns a name length read from the buffer at the current position.
|
private void |
requireNonDeletedRow(TableImpl.RowState rowState,
RowIdImpl rowId) |
private void |
requireValidRowId(RowIdImpl rowId) |
void |
reset()
After calling this method,
Table.getNextRow() will return the first row
in the table, see Cursor.reset() (uses the default cursor). |
private void |
restoreAutoNumbersFromAdd(java.lang.Object[] row)
Restores all autonumber column values from a failed add row.
|
(package private) void |
restoreLastComplexTypeAutoNumber(int lastComplexTypeAutoNumber) |
(package private) void |
restoreLastLongAutoNumber(int lastLongAutoNumber) |
private static void |
returnRowValues(java.util.Map<java.lang.String,java.lang.Object> row,
java.lang.Object[] rowValues,
java.util.List<ColumnImpl> cols) |
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 |
setAllowAutoNumberInsert(java.lang.Boolean allowAutoNumInsert)
Sets the new auto number insert policy for the Table.
|
void |
setErrorHandler(ErrorHandler newErrorHandler)
Sets a new ErrorHandler.
|
java.lang.String |
toString() |
Row |
updateRow(Row row)
Update the given row.
|
java.lang.Object[] |
updateRow(RowId rowId,
java.lang.Object... row)
Update the row with the given id.
|
java.lang.Object[] |
updateRow(TableImpl.RowState rowState,
RowIdImpl rowId,
java.lang.Object... row)
Update the row for the given rowId.
|
<M extends java.util.Map<java.lang.String,java.lang.Object>> |
updateRowFromMap(TableImpl.RowState rowState,
RowIdImpl rowId,
M row) |
private void |
updateTableDefinition(int rowCountInc)
Updates the table definition after rows are modified.
|
void |
updateValue(Column column,
RowId rowId,
java.lang.Object value)
Update the given column's value for the given row id.
|
private java.lang.String |
withErrorContext(java.lang.String msg) |
private static java.lang.String |
withErrorContext(java.lang.String msg,
DatabaseImpl db,
java.lang.String tableName) |
private void |
writeDataPage(java.nio.ByteBuffer pageBuffer,
int pageNumber)
Writes the given page data to the given page number, clears any other
relevant buffers.
|
(package private) static void |
writeName(java.nio.ByteBuffer buffer,
java.lang.String name,
java.nio.charset.Charset charset)
Writes the given name into the given buffer in the format as expected by
readName(java.nio.ByteBuffer). |
protected static void |
writeTableDefinition(TableCreator creator)
Writes a new table defined by the given TableCreator to the database.
|
private static void |
writeTableDefinitionHeader(TableCreator creator,
java.nio.ByteBuffer buffer,
int totalTableDefSize) |
private static void |
writeTablePageHeader(java.nio.ByteBuffer buffer)
Writes the page header for a table definition page
|
private static final org.apache.commons.logging.Log LOG
private static final short OFFSET_MASK
private static final short DELETED_ROW_MASK
private static final short OVERFLOW_ROW_MASK
static final int MAGIC_TABLE_NUMBER
private static final int MAX_BYTE
public static final byte TYPE_SYSTEM
public static final byte TYPE_USER
private static final java.util.Comparator<ColumnImpl> VAR_LEN_COLUMN_COMPARATOR
private static final java.util.Comparator<ColumnImpl> DISPLAY_ORDER_COMPARATOR
private final DatabaseImpl _database
private final int _flags
private final byte _tableType
private final int _indexCount
private final int _logicalIndexCount
private final int _tableDefPageNumber
private final short _maxColumnCount
private final short _maxVarColumnCount
private final java.util.List<ColumnImpl> _columns
private final java.util.List<ColumnImpl> _varColumns
private final java.util.List<ColumnImpl> _autoNumColumns
private final java.util.List<IndexImpl> _indexes
private final java.util.List<IndexData> _indexDatas
private final java.util.Set<ColumnImpl> _indexColumns
private final java.lang.String _name
private final UsageMap _ownedPages
private final UsageMap _freeSpacePages
private int _rowCount
private int _lastLongAutoNumber
private int _lastComplexTypeAutoNumber
private int _modCount
private final TempPageHolder _addRowBufferH
private final TempPageHolder _tableDefBufferH
private final TempBufferHolder _writeRowBufferH
private final TempPageHolder _longValueBufferH
private ErrorHandler _tableErrorHandler
private PropertyMap _props
private PropertyMaps _propertyMaps
private java.lang.Boolean _allowAutoNumInsert
private final FKEnforcer _fkEnforcer
private CursorImpl _defaultCursor
protected TableImpl(boolean testing,
java.util.List<ColumnImpl> columns)
throws java.io.IOException
java.io.IOExceptionprotected TableImpl(DatabaseImpl database, java.nio.ByteBuffer tableBuffer, int pageNumber, java.lang.String name, int flags) throws java.io.IOException
database - database which owns this tabletableBuffer - Buffer to read the table withpageNumber - Page number of the table definitionname - Table namejava.io.IOExceptionpublic java.lang.String getName()
public boolean isHidden()
Tablepublic boolean isSystem()
Tablepublic int getMaxColumnCount()
public int getColumnCount()
getColumnCount in interface Tablepublic DatabaseImpl getDatabase()
getDatabase in interface Tablepublic JetFormat getFormat()
public PageChannel getPageChannel()
public ErrorHandler getErrorHandler()
Tablenull).
This will be used to handle all errors unless overridden at the Cursor
level.getErrorHandler in interface Tablepublic void setErrorHandler(ErrorHandler newErrorHandler)
Tablenull, resets to using the
ErrorHandler configured at the Database level.setErrorHandler in interface Tablepublic int getTableDefPageNumber()
public boolean isAllowAutoNumberInsert()
TableisAllowAutoNumberInsert in interface TableDatabase.isAllowAutoNumberInsert()public void setAllowAutoNumberInsert(java.lang.Boolean allowAutoNumInsert)
Tablenull,
resets to using the policy configured at the Database level.setAllowAutoNumberInsert in interface Tablepublic TableImpl.RowState createRowState()
public 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<ColumnImpl> getColumns()
getColumns in interface Tablepublic ColumnImpl getColumn(java.lang.String name)
public boolean hasColumn(java.lang.String name)
public PropertyMap getProperties() throws java.io.IOException
getProperties in interface Tablejava.io.IOExceptionpublic PropertyMaps getPropertyMaps() throws java.io.IOException
java.io.IOExceptionpublic java.util.List<IndexImpl> getIndexes()
getIndexes in interface Tablepublic IndexImpl getIndex(java.lang.String name)
public IndexImpl getPrimaryKeyIndex()
getPrimaryKeyIndex in interface Tablepublic IndexImpl getForeignKeyIndex(Table otherTable)
getForeignKeyIndex in interface Tablepublic java.util.List<IndexData> getIndexDatas()
public int getLogicalIndexCount()
public CursorImpl getDefaultCursor()
getDefaultCursor in interface Tablepublic CursorBuilder newCursor()
Tablepublic void reset()
TableTable.getNextRow() will return the first row
in the table, see Cursor.reset() (uses the default cursor).public Row deleteRow(Row row) throws java.io.IOException
Tablepublic RowId deleteRow(RowId rowId) throws java.io.IOException
java.lang.IllegalStateException - if the given row is not validjava.io.IOExceptionpublic void deleteRow(TableImpl.RowState rowState, RowIdImpl rowId) throws java.io.IOException
java.io.IOExceptionpublic Row getNextRow() throws java.io.IOException
getNextRow in interface Tabledefault cursor)java.io.IOExceptionpublic java.lang.Object getRowValue(TableImpl.RowState rowState, RowIdImpl rowId, ColumnImpl column) throws java.io.IOException
java.io.IOExceptionpublic RowImpl getRow(TableImpl.RowState rowState, RowIdImpl rowId, java.util.Collection<java.lang.String> columnNames) throws java.io.IOException
columnNames - Only column names in this collection will be returnedjava.io.IOExceptionprivate static RowImpl getRow(JetFormat format, TableImpl.RowState rowState, java.nio.ByteBuffer rowBuffer, java.util.Collection<ColumnImpl> columns, java.util.Collection<java.lang.String> columnNames) throws java.io.IOException
java.io.IOExceptionprivate static java.lang.Object getRowColumn(JetFormat format, java.nio.ByteBuffer rowBuffer, ColumnImpl column, TableImpl.RowState rowState, java.util.Map<ColumnImpl,byte[]> rawVarValues) throws java.io.IOException
java.io.IOExceptionprivate static short[] readJumpTableVarColOffsets(TableImpl.RowState rowState, java.nio.ByteBuffer rowBuffer, int rowStart, NullMask nullMask)
private NullMask getRowNullMask(java.nio.ByteBuffer rowBuffer) throws java.io.IOException
java.io.IOExceptionpublic static java.nio.ByteBuffer positionAtRowHeader(TableImpl.RowState rowState, RowIdImpl rowId) throws java.io.IOException
java.io.IOExceptionpublic static java.nio.ByteBuffer positionAtRowData(TableImpl.RowState rowState, RowIdImpl rowId) throws java.io.IOException
java.io.IOExceptionpublic java.util.Iterator<Row> iterator()
TableTable.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
Table.getNextRow().
For more advanced iteration, use the default
cursor directly.protected static void writeTableDefinition(TableCreator creator) throws java.io.IOException
java.io.IOExceptionprivate static void writeTableDefinitionHeader(TableCreator creator, java.nio.ByteBuffer buffer, int totalTableDefSize) throws java.io.IOException
buffer - Buffer to write tojava.io.IOExceptionprivate static void writeTablePageHeader(java.nio.ByteBuffer buffer)
buffer - Buffer to write tostatic void writeName(java.nio.ByteBuffer buffer,
java.lang.String name,
java.nio.charset.Charset charset)
readName(java.nio.ByteBuffer).private static void createUsageMapDefinitionBuffer(TableCreator creator) throws java.io.IOException
java.io.IOExceptionprivate java.nio.ByteBuffer loadCompleteTableDefinitionBuffer(java.nio.ByteBuffer tableBuffer)
throws java.io.IOException
java.io.IOExceptionprivate void readColumnDefinitions(java.nio.ByteBuffer tableBuffer,
short columnCount)
throws java.io.IOException
java.io.IOExceptionprivate void readIndexDefinitions(java.nio.ByteBuffer tableBuffer)
throws java.io.IOException
java.io.IOExceptionprivate void writeDataPage(java.nio.ByteBuffer pageBuffer,
int pageNumber)
throws java.io.IOException
java.io.IOExceptionprivate java.lang.String readName(java.nio.ByteBuffer buffer)
JetFormat.CHARSETprivate int readNameLength(java.nio.ByteBuffer buffer)
public java.lang.Object[] asRow(java.util.Map<java.lang.String,?> rowMap)
TableTable.addRow(Object...).public java.lang.Object[] asRowWithRowId(java.util.Map<java.lang.String,?> rowMap)
addRow(Object...), where the generated
RowId will be an extra value at the end of the array.ColumnImpl.RETURN_ROW_IDpublic java.lang.Object[] asUpdateRow(java.util.Map<java.lang.String,?> rowMap)
TableCursor.updateCurrentRow(Object...).asUpdateRow in interface Tablepublic RowId getRowId(java.lang.Object[] row)
asRowWithRowId(java.util.Map<java.lang.String, ?>)private java.lang.Object[] asRow(java.util.Map<java.lang.String,?> rowMap,
java.lang.Object defaultValue,
boolean returnRowId)
public java.lang.Object[] addRow(java.lang.Object... row)
throws java.io.IOException
TableTable.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 Table.asRow(java.util.Map<java.lang.String, ?>) 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).
addRow in interface Tablerow - 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.java.io.IOExceptionpublic <M extends java.util.Map<java.lang.String,java.lang.Object>> M addRowFromMap(M row)
throws java.io.IOException
TableTable.asRow(java.util.Map<java.lang.String, ?>) on the given row map and passes the result to Table.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.addRowFromMap in interface Tablejava.io.IOExceptionpublic java.util.List<? extends java.lang.Object[]> addRows(java.util.List<? extends java.lang.Object[]> rows)
throws java.io.IOException
TableTable.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).
Most exceptions thrown from this method will be wrapped with a BatchUpdateException which gives useful information in the case of a
partially successful write.
addRows in interface Tablerows - 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.IOExceptionfor more details on row arrayspublic <M extends java.util.Map<java.lang.String,java.lang.Object>> java.util.List<M> addRowsFromMaps(java.util.List<M> rows)
throws java.io.IOException
TableTable.asRow(java.util.Map<java.lang.String, ?>) on the given row maps and passes the results to
Table.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.
Most exceptions thrown from this method will be wrapped with a BatchUpdateException which gives useful information in the case of a
partially successful write.
addRowsFromMaps in interface Tablejava.io.IOExceptionprivate static void returnRowValues(java.util.Map<java.lang.String,java.lang.Object> row,
java.lang.Object[] rowValues,
java.util.List<ColumnImpl> cols)
private java.util.List<? extends java.lang.Object[]> addRows(java.util.List<? extends java.lang.Object[]> rows,
boolean isBatchWrite)
throws java.io.IOException
rows - List of Object[] row valuesjava.io.IOExceptionprivate static boolean isWriteFailure(java.lang.Throwable t)
public Row updateRow(Row row) throws java.io.IOException
Tablepublic java.lang.Object[] updateRow(RowId rowId, java.lang.Object... row) throws java.io.IOException
java.lang.IllegalStateException - if the given row is not valid, or deleted.java.io.IOExceptionpublic void updateValue(Column column, RowId rowId, java.lang.Object value) throws java.io.IOException
java.lang.IllegalStateException - if the given row is not valid, or deleted.java.io.IOExceptionpublic <M extends java.util.Map<java.lang.String,java.lang.Object>> M updateRowFromMap(TableImpl.RowState rowState, RowIdImpl rowId, M row) throws java.io.IOException
java.io.IOExceptionpublic java.lang.Object[] updateRow(TableImpl.RowState rowState, RowIdImpl rowId, java.lang.Object... row) throws java.io.IOException
java.io.IOExceptionprivate java.nio.ByteBuffer findFreeRowSpace(int rowSize,
java.nio.ByteBuffer dataPage,
int pageNumber)
throws java.io.IOException
java.io.IOExceptionstatic java.nio.ByteBuffer findFreeRowSpace(UsageMap ownedPages, UsageMap freeSpacePages, TempPageHolder rowBufferH) throws java.io.IOException
java.io.IOExceptionprivate void updateTableDefinition(int rowCountInc)
throws java.io.IOException
java.io.IOExceptionprivate java.nio.ByteBuffer newDataPage()
throws java.io.IOException
java.io.IOExceptionprotected java.nio.ByteBuffer createRow(java.lang.Object[] rowArray,
java.nio.ByteBuffer buffer)
throws java.io.IOException
java.io.IOExceptionprivate java.nio.ByteBuffer createRow(java.lang.Object[] rowArray,
java.nio.ByteBuffer buffer,
int minRowSize,
java.util.Map<ColumnImpl,byte[]> rawVarValues)
throws java.io.IOException
rowArray - row data, expected to be correct length for this tablebuffer - buffer to which to write the row dataminRowSize - min size for result rowrawVarValues - optional, pre-written values for var length columns
(enables re-use of previously written values).java.io.IOExceptionprivate void handleAutoNumbersForAdd(java.lang.Object[] row,
TableImpl.WriteRowState writeRowState)
throws java.io.IOException
java.io.IOExceptionprivate void handleAutoNumbersForUpdate(java.lang.Object[] row,
java.nio.ByteBuffer rowBuffer,
TableImpl.RowState rowState)
throws java.io.IOException
java.io.IOExceptionprivate static java.lang.Object getInputAutoNumberRowValue(boolean enableInsert,
ColumnImpl col,
java.lang.Object[] row)
private void restoreAutoNumbersFromAdd(java.lang.Object[] row)
throws java.io.IOException
java.io.IOExceptionprivate static void padRowBuffer(java.nio.ByteBuffer buffer,
int minRowSize,
int trailerSize)
public int getRowCount()
getRowCount in interface Tableint getNextLongAutoNumber()
int getLastLongAutoNumber()
void adjustLongAutoNumber(int inLongAutoNumber)
void restoreLastLongAutoNumber(int lastLongAutoNumber)
int getNextComplexTypeAutoNumber()
int getLastComplexTypeAutoNumber()
void adjustComplexTypeAutoNumber(int inComplexTypeAutoNumber)
void restoreLastComplexTypeAutoNumber(int lastComplexTypeAutoNumber)
public java.lang.String toString()
toString in class java.lang.Objectpublic java.lang.String display()
throws java.io.IOException
java.io.IOExceptionpublic java.lang.String display(long limit)
throws java.io.IOException
limit - Maximum number of rows to displayjava.io.IOExceptionpublic static int addDataPageRow(java.nio.ByteBuffer dataPage,
int rowSize,
JetFormat format,
int rowFlags)
static int getRowsOnDataPage(java.nio.ByteBuffer rowBuffer,
JetFormat format)
throws java.io.IOException
null) or the page is not a DATA page, 0 is returned.java.io.IOExceptionprivate void requireValidRowId(RowIdImpl rowId)
java.lang.IllegalStateException - if the given rowId is invalidprivate void requireNonDeletedRow(TableImpl.RowState rowState, RowIdImpl rowId)
java.lang.IllegalStateException - if the given row is invalid or deletedpublic 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)
private void getAutoNumberColumns()
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.IOExceptionstatic java.lang.Object[] dupeRow(java.lang.Object[] row,
int newRowLength)
null.private java.lang.String withErrorContext(java.lang.String msg)
private static java.lang.String withErrorContext(java.lang.String msg,
DatabaseImpl db,
java.lang.String tableName)