This is the base class for most tables.
A table contains a list of columns and a list of rows.
| Methods |
| void |
addConstraint(Constraint constraint)
Add a constraint to the table.
|
| void |
addConstraint(Constraint constraint)
Add a constraint to the table.
Parameters:
constraint - the constraint to add
|
| void |
addDependencies(HashSet dependencies)
Add all objects that this table depends on to the hash set.
|
| void |
addDependencies(HashSet dependencies)
Add all objects that this table depends on to the hash set.
Parameters:
dependencies - the current set of dependencies
|
| void |
addDependentView(TableView view)
Add a view to this table.
|
| void |
addDependentView(TableView view)
Add a view to this table.
Parameters:
view - the view to add
|
| Index |
addIndex(Session session, String indexName, int indexId, IndexColumn[] cols, IndexType indexType, boolean create, String indexComment)
Create an index for this table
|
| Index |
addIndex(Session session, String indexName, int indexId, IndexColumn[] cols, IndexType indexType, boolean create, String indexComment)
Create an index for this table
Parameters:
session - the session
indexName - the name of the index
indexId - the id
cols - the index columns
indexType - the index type
create - whether this is a new index
indexComment - the comment
Returns:
the index
|
| void |
addRow(Session session, Row row)
Add a row to the table and all indexes.
|
| void |
addRow(Session session, Row row)
Add a row to the table and all indexes.
Parameters:
session - the session
row - the row
Throws:
DbException - if a constraint was violated
|
| void |
addSequence(Sequence sequence)
Add a sequence to this table.
|
| void |
addSequence(Sequence sequence)
Add a sequence to this table.
Parameters:
sequence - the sequence to add
|
| void |
addSynonym(TableSynonym synonym)
Add a synonym to this table.
|
| void |
addSynonym(TableSynonym synonym)
Add a synonym to this table.
Parameters:
synonym - the synonym to add
|
| void |
addTrigger(TriggerObject trigger)
Add a trigger to this table.
|
| void |
addTrigger(TriggerObject trigger)
Add a trigger to this table.
Parameters:
trigger - the trigger to add
|
| boolean |
canDrop()
Check if this table can be dropped.
|
| boolean |
canDrop()
Check if this table can be dropped.
Returns:
true if it can
|
| boolean |
canGetRowCount()
Check if the row count can be retrieved quickly.
|
| boolean |
canGetRowCount()
Check if the row count can be retrieved quickly.
Returns:
true if it can
|
| boolean |
canReference()
Check if this table can be referenced.
|
| boolean |
canReference()
Check if this table can be referenced.
Returns:
true if it can
|
| boolean |
canTruncate()
Check if this table can be truncated.
|
| boolean |
canTruncate()
Check if this table can be truncated.
Returns:
true if it can
|
| ArrayList |
checkDeadlock(Session session, Session clash, Set visited)
Check if a deadlock occurred.
|
| ArrayList |
checkDeadlock(Session session, Session clash, Set visited)
Check if a deadlock occurred. This method is called recursively. There is
a circle if the session to be tested has already being visited. If this
session is part of the circle (if it is the clash session), the method
must return an empty object array. Once a deadlock has been detected, the
methods must add the session to the list. If this session is not part of
the circle, or if no deadlock is detected, this method returns null.
Parameters:
session - the session to be tested for
clash - set with sessions already visited, and null when starting
verification
visited - set with sessions already visited, and null when starting
verification
Returns:
an object array with the sessions involved in the deadlock, or
null
|
| void |
checkSupportAlter()
Check if this table supports ALTER TABLE.
|
| void |
checkSupportAlter()
Check if this table supports ALTER TABLE.
Throws:
DbException - if it is not supported
|
| void |
checkWritingAllowed()
Tests if the table can be written.
|
| void |
checkWritingAllowed()
Tests if the table can be written. Usually, this depends on the
database.checkWritingAllowed method, but some tables (eg. TableLink)
overwrite this default behaviour.
|
| void |
close(Session session)
Close the table object and flush changes.
|
| void |
close(Session session)
Close the table object and flush changes.
Parameters:
session - the session
|
| void |
commit(short operation, Row row)
Commit an operation (when using multi-version concurrency).
|
| void |
commit(short operation, Row row)
Commit an operation (when using multi-version concurrency).
Parameters:
operation - the operation
row - the row
|
| int |
compareTypeSafe(Value a, Value b)
Compare two values with the current comparison mode.
|
| int |
compareTypeSafe(Value a, Value b)
Compare two values with the current comparison mode. The values may be of
different type.
Parameters:
a - the first value
b - the second value
Returns:
0 if both values are equal, -1 if the first value is smaller, and
1 otherwise
|
| boolean |
doesColumnExist(String columnName)
Does the column with the given name exist?
|
| boolean |
doesColumnExist(String columnName)
Does the column with the given name exist?
Parameters:
columnName - the column name
Returns:
true if the column exists
|
| void |
dropMultipleColumnsConstraintsAndIndexes(Session session, ArrayList columnsToDrop)
Check that these columns are not referenced by a multi-column constraint
or multi-column index.
|
| void |
dropMultipleColumnsConstraintsAndIndexes(Session session, ArrayList columnsToDrop)
Check that these columns are not referenced by a multi-column constraint
or multi-column index. If it is, an exception is thrown. Single-column
references and indexes are dropped.
Parameters:
session - the session
columnsToDrop - the columns to drop
Throws:
DbException - if the column is referenced by multi-column
constraints or indexes
|
| Index |
findPrimaryKey()
Get the primary key index if there is one, or null if there is none.
|
| Index |
findPrimaryKey()
Get the primary key index if there is one, or null if there is none.
Returns:
the primary key index or null
|
| void |
fire(Session session, int type, boolean beforeAction)
Fire the triggers for this table.
|
| void |
fire(Session session, int type, boolean beforeAction)
Fire the triggers for this table.
Parameters:
session - the session
type - the trigger type
beforeAction - whether 'before' triggers should be called
|
| void |
fireAfterRow(Session session, Row oldRow, Row newRow, boolean rollback)
Fire all triggers that need to be called after a row is updated.
|
| void |
fireAfterRow(Session session, Row oldRow, Row newRow, boolean rollback)
Fire all triggers that need to be called after a row is updated.
Parameters:
session - the session
oldRow - the old data or null for an insert
newRow - the new data or null for a delete
rollback - when the operation occurred within a rollback
|
| boolean |
fireBeforeRow(Session session, Row oldRow, Row newRow)
Fire all triggers that need to be called before a row is updated.
|
| boolean |
fireBeforeRow(Session session, Row oldRow, Row newRow)
Fire all triggers that need to be called before a row is updated.
Parameters:
session - the session
oldRow - the old data or null for an insert
newRow - the new data or null for a delete
Returns:
true if no further action is required (for 'instead of' triggers)
|
| boolean |
fireRow()
Check if row based triggers or constraints are defined.
|
| boolean |
fireRow()
Check if row based triggers or constraints are defined.
In this case the fire after and before row methods need to be called.
Returns:
if there are any triggers or rows defined
|
| PlanItem |
getBestPlanItem(Session session, int[] masks, TableFilter[] filters, int filter, SortOrder sortOrder, HashSet allColumnsSet)
Get the best plan for the given search mask.
|
| PlanItem |
getBestPlanItem(Session session, int[] masks, TableFilter[] filters, int filter, SortOrder sortOrder, HashSet allColumnsSet)
Get the best plan for the given search mask.
Parameters:
session - the session
masks - per-column comparison bit masks, null means 'always false',
see constants in IndexCondition
filters - all joined table filters
filter - the current table filter index
sortOrder - the sort order
allColumnsSet - the set of all columns
Returns:
the plan item
|
| boolean |
getCheckForeignKeyConstraints()
|
| boolean |
getCheckForeignKeyConstraints()
|
| ArrayList |
getChildren()
|
| ArrayList |
getChildren()
|
| Column |
getColumn(int index)
Get the column at the given index.
|
| Column |
getColumn(int index)
Get the column at the given index.
Parameters:
index - the column index (0, 1,...)
Returns:
the column
|
| Column |
getColumn(String columnName)
Get the column with the given name.
|
| Column |
getColumn(String columnName)
Get the column with the given name.
Parameters:
columnName - the column name
Returns:
the column
Throws:
DbException - if the column was not found
|
| Column[] |
getColumns()
|
| Column[] |
getColumns()
|
| CompareMode |
getCompareMode()
|
| CompareMode |
getCompareMode()
|
| ArrayList |
getConstraints()
|
| ArrayList |
getConstraints()
|
| String |
getCreateSQLForCopy(Table table, String quotedName)
|
| String |
getCreateSQLForCopy(Table table, String quotedName)
|
| Value |
getDefaultValue(Session session, Column column)
Get or generate a default value for the given column.
|
| Value |
getDefaultValue(Session session, Column column)
Get or generate a default value for the given column.
Parameters:
session - the session
column - the column
Returns:
the value
|
| CopyOnWriteArrayList |
getDependentViews()
|
| CopyOnWriteArrayList |
getDependentViews()
|
| long |
getDiskSpaceUsed()
|
| long |
getDiskSpaceUsed()
|
| Index |
getIndex(String indexName)
Get an index by name.
|
| Index |
getIndex(String indexName)
Get an index by name.
Parameters:
indexName - the index name to search for
Returns:
the found index
|
| Index |
getIndexForColumn(Column column, boolean needGetFirstOrLast, boolean needFindNext)
Get the index that has the given column as the first element.
|
| Index |
getIndexForColumn(Column column, boolean needGetFirstOrLast, boolean needFindNext)
Get the index that has the given column as the first element.
This method returns null if no matching index is found.
Parameters:
column - the column
needGetFirstOrLast - if the returned index must be able
to do {@link Index#canGetFirstOrLast()}
needFindNext - if the returned index must be able to do
{@link Index#findNext(Session, SearchRow, SearchRow)}
Returns:
the index or null
|
| ArrayList |
getIndexes()
Get all indexes for this table.
|
| ArrayList |
getIndexes()
Get all indexes for this table.
Returns:
the list of indexes
|
| long |
getMaxDataModificationId()
Get the last data modification id.
|
| long |
getMaxDataModificationId()
Get the last data modification id.
Returns:
the modification id
|
| Row |
getNullRow()
|
| Row |
getNullRow()
|
| boolean |
getOnCommitDrop()
|
| boolean |
getOnCommitDrop()
|
| boolean |
getOnCommitTruncate()
|
| boolean |
getOnCommitTruncate()
|
| Value |
getOnUpdateValue(Session session, Column column)
Generates on update value for the given column.
|
| Value |
getOnUpdateValue(Session session, Column column)
Generates on update value for the given column.
Parameters:
session - the session
column - the column
Returns:
the value
|
| Index |
getPrimaryKey()
|
| Index |
getPrimaryKey()
|
| Row |
getRow(Session session, long key)
Get the given row.
|
| Row |
getRow(Session session, long key)
Get the given row.
Parameters:
session - the session
key - the primary key
Returns:
the row
|
| long |
getRowCount(Session session)
Get the row count for this table.
|
| long |
getRowCount(Session session)
Get the row count for this table.
Parameters:
session - the session
Returns:
the row count
|
| long |
getRowCountApproximation()
Get the approximated row count for this table.
|
| long |
getRowCountApproximation()
Get the approximated row count for this table.
Returns:
the approximated row count
|
| Column |
getRowIdColumn()
Get the row id column if this table has one.
|
| Column |
getRowIdColumn()
Get the row id column if this table has one.
Returns:
the row id column, or null
|
| Index |
getScanIndex(Session session)
Get the scan index to iterate through all rows.
|
| Index |
getScanIndex(Session session)
Get the scan index to iterate through all rows.
Parameters:
session - the session
Returns:
the index
|
| Index |
getScanIndex(Session session, int[] masks, TableFilter[] filters, int filter, SortOrder sortOrder, HashSet allColumnsSet)
Get the scan index for this table.
|
| Index |
getScanIndex(Session session, int[] masks, TableFilter[] filters, int filter, SortOrder sortOrder, HashSet allColumnsSet)
Get the scan index for this table.
Parameters:
session - the session
masks - the search mask
filters - the table filters
filter - the filter index
sortOrder - the sort order
allColumnsSet - all columns
Returns:
the scan index
|
| TableType |
getTableType()
Get the table type name
|
| TableType |
getTableType()
Get the table type name
Returns:
the table type name
|
| Row |
getTemplateRow()
|
| Row |
getTemplateRow()
|
| SearchRow |
getTemplateSimpleRow(boolean singleColumn)
Get a new simple row object.
|
| SearchRow |
getTemplateSimpleRow(boolean singleColumn)
Get a new simple row object.
Parameters:
singleColumn - if only one value need to be stored
Returns:
the simple row object
|
| int |
getType()
|
| int |
getType()
|
| Index |
getUniqueIndex()
Get any unique index for this table if one exists.
|
| Index |
getUniqueIndex()
Get any unique index for this table if one exists.
Returns:
a unique index
|
| boolean |
hasSelectTrigger()
Check whether this table has a select trigger.
|
| boolean |
hasSelectTrigger()
Check whether this table has a select trigger.
Returns:
true if it has
|
| boolean |
isDeterministic()
Check if the table is deterministic.
|
| boolean |
isDeterministic()
Check if the table is deterministic.
Returns:
true if it is
|
| boolean |
isGlobalTemporary()
|
| boolean |
isGlobalTemporary()
|
| boolean |
isHidden()
|
| boolean |
isHidden()
|
| boolean |
isLockedExclusively()
Check if this table is locked exclusively.
|
| boolean |
isLockedExclusively()
Check if this table is locked exclusively.
Returns:
true if it is.
|
| boolean |
isLockedExclusivelyBy(Session session)
Check if the table is exclusively locked by this session.
|
| boolean |
isLockedExclusivelyBy(Session session)
Check if the table is exclusively locked by this session.
Parameters:
session - the session
Returns:
true if it is
|
| boolean |
isMVStore()
|
| boolean |
isMVStore()
|
| boolean |
isPersistData()
|
| boolean |
isPersistData()
|
| boolean |
isPersistIndexes()
|
| boolean |
isPersistIndexes()
|
| boolean |
isQueryComparable()
Check whether the table (or view) contains no columns that prevent index
conditions to be used.
|
| boolean |
isQueryComparable()
Check whether the table (or view) contains no columns that prevent index
conditions to be used. For example, a view that contains the ROWNUM()
pseudo-column prevents this.
Returns:
true if the table contains no query-comparable column
|
| boolean |
isTableExpression()
|
| boolean |
isTableExpression()
|
| boolean |
isView()
|
| boolean |
isView()
|
| boolean |
lock(Session session, boolean exclusive, boolean forceLockEvenInMvcc)
Lock the table for the given session.
|
| boolean |
lock(Session session, boolean exclusive, boolean forceLockEvenInMvcc)
Lock the table for the given session.
This method waits until the lock is granted.
Parameters:
session - the session
exclusive - true for write locks, false for read locks
forceLockEvenInMvcc - lock even in the MVCC mode
Returns:
true if the table was already exclusively locked by this session.
Throws:
DbException - if a lock timeout occurred
|
| void |
removeChildrenAndResources(Session session)
|
| void |
removeChildrenAndResources(Session session)
|
| void |
removeConstraint(Constraint constraint)
Remove the given constraint from the list.
|
| void |
removeConstraint(Constraint constraint)
Remove the given constraint from the list.
Parameters:
constraint - the constraint to remove
|
| void |
removeDependentView(TableView view)
Remove the given view from the dependent views list.
|
| void |
removeDependentView(TableView view)
Remove the given view from the dependent views list.
Parameters:
view - the view to remove
|
| void |
removeIndex(Index index)
Remove the given index from the list.
|
| void |
removeIndex(Index index)
Remove the given index from the list.
Parameters:
index - the index to remove
|
| void |
removeIndexOrTransferOwnership(Session session, Index index)
If the index is still required by a constraint, transfer the ownership to
it.
|
| void |
removeIndexOrTransferOwnership(Session session, Index index)
If the index is still required by a constraint, transfer the ownership to
it. Otherwise, the index is removed.
Parameters:
session - the session
index - the index that is no longer required
|
| void |
removeRow(Session session, Row row)
Remove a row from the table and all indexes.
|
| void |
removeRow(Session session, Row row)
Remove a row from the table and all indexes.
Parameters:
session - the session
row - the row
|
| void |
removeSequence(Sequence sequence)
Remove a sequence from the table.
|
| void |
removeSequence(Sequence sequence)
Remove a sequence from the table. Sequences are used as identity columns.
Parameters:
sequence - the sequence to remove
|
| void |
removeSynonym(TableSynonym synonym)
Remove the given view from the list.
|
| void |
removeSynonym(TableSynonym synonym)
Remove the given view from the list.
Parameters:
synonym - the synonym to remove
|
| void |
removeTrigger(TriggerObject trigger)
Remove the given trigger from the list.
|
| void |
removeTrigger(TriggerObject trigger)
Remove the given trigger from the list.
Parameters:
trigger - the trigger to remove
|
| void |
rename(String newName)
|
| void |
rename(String newName)
|
| void |
renameColumn(Column column, String newName)
Rename a column of this table.
|
| void |
renameColumn(Column column, String newName)
Rename a column of this table.
Parameters:
column - the column to rename
newName - the new column name
|
| void |
setCheckForeignKeyConstraints(Session session, boolean enabled, boolean checkExisting)
Enable or disable foreign key constraint checking for this table.
|
| void |
setCheckForeignKeyConstraints(Session session, boolean enabled, boolean checkExisting)
Enable or disable foreign key constraint checking for this table.
Parameters:
session - the session
enabled - true if checking should be enabled
checkExisting - true if existing rows must be checked during this
call
|
| void |
setColumns(Column[] columns)
|
| void |
setColumns(Column[] columns)
|
| void |
setHidden(boolean hidden)
|
| void |
setHidden(boolean hidden)
|
| void |
setOnCommitDrop(boolean onCommitDrop)
|
| void |
setOnCommitDrop(boolean onCommitDrop)
|
| void |
setOnCommitTruncate(boolean onCommitTruncate)
|
| void |
setOnCommitTruncate(boolean onCommitTruncate)
|
| void |
setTableExpression(boolean tableExpression)
|
| void |
setTableExpression(boolean tableExpression)
|
| void |
truncate(Session session)
Remove all rows from the table and indexes.
|
| void |
truncate(Session session)
Remove all rows from the table and indexes.
Parameters:
session - the session
|
| void |
unlock(Session s)
Release the lock for this session.
|
| void |
unlock(Session s)
Release the lock for this session.
Parameters:
s - the session
|
| void |
updateRows(Prepared prepared, Session session, RowList rows)
Update a list of rows in this table.
|
| void |
updateRows(Prepared prepared, Session session, RowList rows)
Update a list of rows in this table.
Parameters:
prepared - the prepared statement
session - the session
rows - a list of row pairs of the form old row, new row, old row,
new row,...
|
| void |
validateConvertUpdateSequence(Session session, Row row)
Validate all values in this row, convert the values if required, and
update the sequence values if required.
|
| void |
validateConvertUpdateSequence(Session session, Row row)
Validate all values in this row, convert the values if required, and
update the sequence values if required. This call will also set the
default values if required and set the computed column if there are any.
Parameters:
session - the session
row - the row
|
The table type that means this table is a regular persistent table.
The table type that means this table is a regular persistent table.
The columns of this table.
The compare mode used for this table.
Protected tables are not listed in the meta data and are excluded when
using the SCRIPT command.