Top Description Fields Constructors Methods
org.hsqldb

public Class Table

extends TableBase
implements SchemaObject
Class Inheritance
All Implemented Interfaces
org.hsqldb.SchemaObject
Known Direct Subclasses
org.hsqldb.TableDerived, org.hsqldb.TextTable
Imports
org.hsqldb.HsqlNameManager.HsqlName, org.hsqldb.error.Error, .ErrorCode, org.hsqldb.index.Index, .Index.IndexUse, org.hsqldb.lib.ArrayUtil, .HsqlArrayList, .OrderedHashMap, .OrderedHashSet, .OrderedIntHashSet, .Set, .StringUtil, org.hsqldb.map.ValuePool, org.hsqldb.navigator.RangeIterator, .RowIterator, .RowSetNavigator, .RowSetNavigatorDataChange, org.hsqldb.persist.CachedObject, .DataSpaceManager, .PersistentStore, org.hsqldb.result.Result, org.hsqldb.rights.Grantee, org.hsqldb.trigger.Trigger, org.hsqldb.types.Collation, .DateTimeType, .TimestampData, .Type

Holds the data structures and methods for creation of a named database table.
Author
Fred Toussi (fredt@users dot sourceforge.net)
Since
1.6.1
Version
2.7.4

Field Summary

Modifier and TypeField and Description
pack-priv PeriodDefinition
pack-priv int
protected long
pack-priv Constraint[]
pack-priv Expression[]
pack-priv boolean[]
pack-priv boolean[]
pack-priv boolean[]
public OrderedHashMap<String, ColumnSchema>
pack-priv boolean[]
pack-priv Constraint[]
protected int[]
private RangeVariable[]
public static final Table[]
pack-priv Constraint[]
pack-priv Constraint[]
private boolean
private boolean
private boolean
private boolean
private boolean
pack-priv int
pack-priv NumberSequence
pack-priv boolean
pack-priv int
pack-priv PeriodDefinition
pack-priv int
pack-priv int
protected HsqlNameManager.HsqlName
pack-priv TriggerDef[]
pack-priv TriggerDef[][]
Inherited from org.hsqldb.TableBase:
bestIndexbestIndexForColumnbestRowIdentifierColsbestRowIdentifierStrictCACHED_TABLECHANGE_SET_TABLEcolNotNullcolTypescolumnCountdatabaseemptyColumnCheckListfullIndexFUNCTION_TABLEhasLobColumnindexListINFO_SCHEMA_TABLEisCachedisLoggedisReadOnlyisSchemaBasedisSessionBasedisSystemVersionedisTempisTextisViewisWithDataSourceMEMORY_TABLEMODULE_TABLEpersistenceIdpersistenceScopeRESULT_TABLESCOPE_FULLSCOPE_ROUTINESCOPE_SESSIONSCOPE_STATEMENTSCOPE_TRANSACTIONstoreSYSTEM_SUBQUERYSYSTEM_TABLEtableSpacetableTypeTEMP_TABLETEMP_TEXT_TABLETEXT_TABLETRANSITION_TABLEVIEW_TABLE

Constructor Summary

AccessConstructor and Description
public
Table(Database database, HsqlNameManager.HsqlName name, int type)

public
Table(Table table, HsqlNameManager.HsqlName name)

trigger transition table

Method Summary

Modifier and TypeMethod and Description
public void
addColumn(ColumnSchema column)

Performs the table level checks and adds a column to the table at the DDL level.

public void
public void
addConstraint(Constraint c)

Adds a constraint.

pack-priv void
addTrigger(TriggerDef td, HsqlNameManager.HsqlName otherName)

Adds a trigger.

pack-priv boolean
areColumnsNotNull(int[] indexes)

pack-priv void
checkColumnInCheckConstraint(int colIndex)

Used for drop / retype column.

pack-priv void
checkColumnInFKConstraint(int
index
colIndex
)

Used for retype column.

pack-priv void
checkColumnInFKConstraint(int
index of column
colIndex
,
int
referential action of the FK
actionType
)

Used for column defaults and nullability.

public void
checkDataReadOnly()

Used by INSERT, DELETE, UPDATE operations

pack-priv void
checkReferentialColumnsMatch(int[]
column array from this Table
col
,
Table
the other Table object
other
,
int[]
column array from the other Table
othercol
)

Match two valid, equal length, columns arrays for type of columns for referential constraints

pack-priv void
collectFKReadLocks(int[] columnMap, OrderedHashSet<HsqlNameManager.HsqlName> set)

columnMap is null for deletes

pack-priv void
collectFKWriteLocks(int[] columnMap, OrderedHashSet<HsqlNameManager.HsqlName> set)

columnMap is null for deletes

public static int

Returns:

comparison result, -1,0,+1
compareRows
(Session session, Object[]
a full row
a
,
Object[]
a full row
b
,
int[]
array of column indexes to compare
cols
,
Type[]
array of column types for the full row
coltypes
)

compares two full table rows based on a set of columns

public void
compile(Session session, SchemaObject parentObject)

Overrides default org.hsqldb.SchemaObject.compile.

pack-priv Index
createIndexForColumns(Session session, int[] columns)

Used to create an index automatically for system and temp tables.

public void
createPrimaryKey()

Shortcut for creating default PK's.

public void
createPrimaryKey(HsqlNameManager.HsqlName indexName, int[] columns, boolean columnsNotNull)

Creates a single or multi-column primary key and index.

public void
createPrimaryKeyConstraint(HsqlNameManager.HsqlName indexName, int[] columns, boolean columnsNotNull)

public void
enforceRowConstraints(Session session, Object[] data)

Enforce not null and domain size constraints

public void
enforceTypeLimits(Session session, Object[] data)

Enforce max field sizes according to SQL column definition.

public int
findColumn(String name)

Returns the index of given column name or -1 if not found.

pack-priv int[]
pack-priv Index.IndexUse[]
findIndexForColumns(Session session, OrderedIntHashSet set, int opType, boolean ordered)

pack-priv void
fireTriggers(Session session, int trigVecIndex, RowSetNavigatorDataChange rowSet)

pack-priv void
fireTriggers(Session session, int trigVecIndex, RowSetNavigator rowSet)

pack-priv void
fireTriggers(Session session, int trigVecIndex, Object[] oldData, Object[] newData, int[] cols)

Fires all row-level triggers of the given set (trigger type)

public void
public void
generateDefaultForNull(Object[] data)

for default values (not expressions)

public PeriodDefinition
public Table
public int[]
public int[]
public HsqlNameManager.HsqlName
getCatalogName()

Implements org.hsqldb.SchemaObject.getCatalogName.

Returns the catalog name

public long
public Index
public ColumnSchema
getColumn(int i)

Returns the Column object at the given index

pack-priv boolean[]
getColumnCheckList(int[] columnIndexes)

public Object
public int
getColumnIndex(String name)

Returns the index of given column name or throws if not found

pack-priv int[]
public String[]
public String
getColumnListSQL(int[] col, int len)

public String
public int[]
getColumnMap()

Returns direct mapping array.

public void
getColumnNames(boolean[] columnCheckList, Set<HsqlNameManager.HsqlName> set)

public OrderedHashSet<HsqlNameManager.HsqlName>
public OrderedHashSet<SchemaObject>
public Constraint
getConstraint(String constraintName)

return the named constraint

pack-priv int
getConstraintIndex(String constraintName)

Return the position of the constraint within the list

public Constraint[]
getConstraints()

Returns the list of constraints.

pack-priv OrderedHashSet<Constraint>
getContainingConstraints(int colIndex)

Returns list of constraints dependent on more than one column

pack-priv OrderedHashSet<HsqlNameManager.HsqlName>
public Expression
public RangeVariable[]
public Row
getDeleteRowFromLog(Session session, Object[] data)

For log statements.

pack-priv OrderedHashSet<Constraint>
getDependentConstraints(int colIndex)

Returns list of constraints dependent only on one column

pack-priv OrderedHashSet<Constraint>
getDependentConstraints(Constraint constraint)

Returns list of MAIN constraints dependent on this PK or UNIQUE constraint

public OrderedHashSet<Constraint>
pack-priv Constraint
getFKConstraintForColumns(Table tableMain, int[] mainCols, int[] refCols)

Returns any foreign key constraint equivalent to the column sets

public Constraint[]
getFKConstraints()

Returns the list of FK constraints.

public Index
getFullIndex(Session session)

Returns an index on all the columns

pack-priv Index
getFullIndexForColumns(int[] cols)

Finds an existing index for an ordered full column group

public long
getId()

Overrides org.hsqldb.TableBase.getId.

Used to create row id's

public int
getIdentityColumnIndex()

Returns the identity column index.

pack-priv Index
getIndex(String indexName)

Returns the Index object of the given name or null if not found.

pack-priv Index
getIndexForAllColumns(int[] cols)

Finds an existing index for an unordered full column group

pack-priv synchronized Index
getIndexForColumn(Session session, int col)

Finds an existing index for a column

pack-priv synchronized Index
getIndexForColumns(int[] cols)

Finds an existing index for a column group - for persistent tables

pack-priv synchronized Index.IndexUse[]
getIndexForColumns(Session session, OrderedIntHashSet set, int opType, boolean ordered)

Finds an existing index for a column set or create one for temporary tables.

pack-priv int
getIndexIndex(String indexName)

Returns the index of the Index object of the given name or -1 if not found.

public final long[]
getIndexRootsArray()

Return the list of file pointers to root nodes for this table's indexes.

public String
getIndexRootsSQL(long[] roots)

public final HsqlNameManager.HsqlName
getName()

Implements org.hsqldb.SchemaObject.getName.

Returns the HsqlName object fo the table

pack-priv int[]
getNewColumnMap()

Returns empty mapping array.

public Object[]
getNewRowData(Session session)

Returns array for a new row with SQL DEFAULT value for each column n where exists[n] is false.

pack-priv int
getNextConstraintIndex(int from, int type)

Returns the next constraint of a given type

pack-priv Constraint
public Grantee
public Constraint
getPrimaryConstraint()

Returns the primary constraint.

public QueryExpression
public OrderedHashSet<HsqlNameManager.HsqlName>
public OrderedHashSet<HsqlNameManager.HsqlName>
public OrderedHashSet<HsqlNameManager.HsqlName>
public PersistentStore
getRowStore(Session session)

Overrides org.hsqldb.TableBase.getRowStore.

Path used for all stores

public HsqlNameManager.HsqlName
getSchemaName()

Implements org.hsqldb.SchemaObject.getSchemaName.

Returns the schema name.

public String
pack-priv HsqlArrayList<String>
public String
public String
public String
public String[]
getSQLForTextSource(boolean withHeader)

pack-priv Index
getSystemIndex(String indexName)

Returns the Index object of the given name or null if not found.

public PeriodDefinition
public int
public int
public String
pack-priv TriggerDef
getTrigger(String name)

Returns a trigger.

public int
public TriggerDef[]
public HsqlArrayList<String>
public int
pack-priv Constraint
getUniqueConstraintForColumns(int[] cols)

Returns the UNIQUE or PK constraint with the given column signature.

public Constraint
getUniqueConstraintForIndex(Index index)

Returns any unique Constraint using this index

pack-priv int[]
getUniqueNotNullColumnGroup(boolean[] usedColumns)

public Constraint
getUniqueOrPKConstraintForIndex(Index index)

Returns any unique Constraint using this index

public OrderedHashSet<HsqlNameManager.HsqlName>
public int[]
pack-priv Index
getUserIndex(String indexName)

Returns the Index object of the given name or null if not found.

public boolean
public boolean
public boolean
pack-priv boolean
hasTrigger(int trigVecIndex)

public boolean
pack-priv int
indexTypeForColumn(Session session, int col)

public void
insertData(Session session, PersistentStore store, Object[] data, boolean enforceUnique)

For system operations outside transaction control

public void
insertFromScript(Session session, PersistentStore store, Object[] data)

Not for general use.

pack-priv void
insertIntoTable(Session session, Result result)

Multi-row insert method.

public void
pack-priv void
insertResult(Session session, PersistentStore store, Result ins)

Used for subquery inserts.

pack-priv Row
insertSingleRow(Session session, PersistentStore store, Object[] data, int[] changedCols)

Mid level method for inserting single rows.

public int
insertSys(Session session, PersistentStore store, Result ins)

Used for system table inserts.

public void
insertSys(Session session, PersistentStore store, Object[] data)

Used by the system tables only

pack-priv Row
insertSystemVersionHistoryRow(Session session, PersistentStore store, Object[] data)

Method for inserting system version history row

public boolean
public boolean
public boolean
public boolean
public boolean
public boolean
isFileBased()

Text or Cached Tables are normally file based

pack-priv boolean
isIndexed(int colIndex)

pack-priv final boolean
isIndexingMutable()

returns false if the table has to be recreated in order to add / drop indexes.

public boolean
public boolean
public final boolean
public final boolean
public final boolean
public final boolean
public boolean
public boolean
public boolean
public boolean
public final boolean
public final boolean
public boolean
public void
public void
pack-priv Table
moveDefinition(Session session, int newType, ColumnSchema[] columns, Constraint constraint, Index index, int[] colIndex, int adjust, OrderedHashSet<HsqlNameManager.HsqlName> dropConstraints, OrderedHashSet<HsqlNameManager.HsqlName> dropIndexes)

For removal or addition of columns, constraints and indexes HsqlName objects are used from the old tables but no object is reused.

public void
pack-priv void
releaseTriggers()

Used when dropping all triggers.

pack-priv void
removeConstraint(String name)

remove a named constraint

pack-priv void
removeConstraint(int index)

pack-priv void
removeTrigger(TriggerDef trigger)

Drops a trigger.

pack-priv void
renameColumn(ColumnSchema column, String newName, boolean isquoted)

pack-priv void
pack-priv void
resetDefaultFlags()

recreates various flags based on column properties

public RowIterator
public RowIterator
pack-priv void
pack-priv void
public void
setDataReadOnly(boolean value)

public void
public void
protected void
setIdentityColumn(Session session, Object[] data)

If there is an identity column in the table, sets the value and/or adjusts the identity value for the table.

public void
setIndexRoots(long[] roots)

pack-priv void
setIndexRoots(Session session, String s)

Sets the index roots.

public final void
private void
public void
setUpdatedColumns(Session session, Object[] data, int[] colMap)

public void
public void
systemUpdateIdentityValue(Object[] data)

If there is an identity column in the table, sets the max identity value.

pack-priv void
pack-priv void
pack-priv void
Inherited from org.hsqldb.TableBase:
addIndexaddIndexStructurecreateAndAddIndexStructurecreateIndexcreateIndexStructurecreatePrimaryIndexdropIndexduplicategetColumnCountgetColumnNotNullgetColumnTypesgetDataColumnCountgetDefaultIndexgetEmptyColumnCheckListgetEmptyRowDatagetIndexgetIndexCountgetIndexListgetNewColumnCheckListgetNewIndexArraygetNewPrimaryIndexgetPersistenceIdgetPrimaryIndexgetPrimaryKeygetPrimaryKeyTypesgetSpaceIDgetTableTypehasPrimaryKeyisEmptyisSystemVersionedonCommitPreserverowIteratorrowIteratorsetBestRowIdentifierssetIndexessetSpaceIDsetTableType