org.hsqldb
Class Table
- java.lang.Object
-
- org.hsqldb.TableBase
-
- org.hsqldb.Table
-
- All Implemented Interfaces:
- SchemaObject
- Direct Known Subclasses:
- TableDerived, TextTable
public class Table extends TableBase implements SchemaObject
Holds the data structures and methods for creation of a named database table.- Since:
- 1.6.1
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.hsqldb.SchemaObject
SchemaObject.ConstraintTypes, SchemaObject.Deferable, SchemaObject.Nullability, SchemaObject.ParameterModes, SchemaObject.ReferentialAction, SchemaObject.ViewCheckModes
-
-
Field Summary
Fields Modifier and Type Field and Description HashMappedListcolumnListstatic Table[]emptyArray-
Fields inherited from class org.hsqldb.TableBase
CACHED_TABLE, CHANGE_SET_TABLE, database, FUNCTION_TABLE, INFO_SCHEMA_TABLE, isSessionBased, MEMORY_TABLE, persistenceId, persistenceScope, RESULT_TABLE, SCOPE_FULL, SCOPE_ROUTINE, SCOPE_SESSION, SCOPE_STATEMENT, SCOPE_TRANSACTION, store, SYSTEM_SUBQUERY, SYSTEM_TABLE, TEMP_TABLE, TEMP_TEXT_TABLE, TEXT_TABLE, TRANSITION_TABLE, VIEW_TABLE
-
Fields inherited from interface org.hsqldb.SchemaObject
ASSERTION, CATALOG, CHARSET, COLLATION, COLUMN, CONSTRAINT, CURSOR, DOMAIN, FUNCTION, GRANTEE, INDEX, LABEL, PARAMETER, PROCEDURE, ROUTINE, SCHEMA, SEARCH, SEQUENCE, SERVER, SPECIFIC_ROUTINE, SUBQUERY, TABLE, TRANSITION, TRIGGER, TYPE, VARIABLE, VIEW, WRAPPER
-
-
Constructor Summary
Constructors Constructor and Description Table(Database database, HsqlNameManager.HsqlName name, int type)Table(Table table, HsqlNameManager.HsqlName name)trigger transition table
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method and Description voidaddColumn(ColumnSchema column)Performs the table level checks and adds a column to the table at the DDL level.voidaddColumnNoCheck(ColumnSchema column)voidaddConstraint(Constraint c)Adds a constraint.voidcheckDataReadOnly()Used by INSERT, DELETE, UPDATE operationsvoidclearAllData(PersistentStore store)voidclearAllData(Session session)static intcompareRows(Session session, java.lang.Object[] a, java.lang.Object[] b, int[] cols, Type[] coltypes)compares two full table rows based on a set of columnsvoidcompile(Session session, SchemaObject parentObject)voidcreatePrimaryKey()Shortcut for creating default PK's.voidcreatePrimaryKey(HsqlNameManager.HsqlName indexName, int[] columns, boolean columnsNotNull)Creates a single or multi-column primary key and index.voidcreatePrimaryKeyConstraint(HsqlNameManager.HsqlName indexName, int[] columns, boolean columnsNotNull)voidenforceRowConstraints(Session session, java.lang.Object[] data)Enforce max field sizes according to SQL column definition.voidenforceTypeLimits(Session session, java.lang.Object[] data)intfindColumn(java.lang.String name)Returns the index of given column name or -1 if not found.TablegetBaseTable()int[]getBaseTableColumnMap()int[]getBestRowIdentifiers()HsqlNameManager.HsqlNamegetCatalogName()Returns the catalog name or null, depending on a database property.longgetChangeTimestamp()IndexgetClusteredIndex()ColumnSchemagetColumn(int i)Returns the Column object at the given indexintgetColumnIndex(java.lang.String name)Returns the index of given column name or throws if not foundjava.lang.StringgetColumnListSQL(int[] col, int len)java.lang.StringgetColumnListWithTypeSQL()voidgetColumnNames(boolean[] columnCheckList, Set set)OrderedHashSetgetColumnNameSet()OrderedHashSetgetColumnNameSet(boolean[] columnCheckList)OrderedHashSetgetColumnNameSet(int[] columnIndexes)OrderedHashSetgetComponents()ConstraintgetConstraint(java.lang.String constraintName)return the named constriantConstraint[]getConstraints()Returns the list of constraints.ExpressiongetDataExpression()RangeVariable[]getDefaultRanges()RowgetDeleteRowFromLog(Session session, java.lang.Object[] data)For log statements.OrderedHashSetgetDependentExternalConstraints()Constraint[]getFKConstraints()Returns the list of FK constraints.intgetId()Used to create row id'slong[]getIndexRootsArray()Return the list of file pointers to root nodes for this table's indexes.java.lang.StringgetIndexRootsSQL(long[] roots)HsqlNameManager.HsqlNamegetName()Returns the HsqlName object fo the tablelonggetNextIdentity()GranteegetOwner()ConstraintgetPrimaryConstraint()Returns the primary constraint.QueryExpressiongetQueryExpression()OrderedHashSetgetReferences()OrderedHashSetgetReferencesForDependents()PersistentStoregetRowStore(Session session)Path used for all storesHsqlNameManager.HsqlNamegetSchemaName()Returns the schema name.java.lang.StringgetSQL()java.lang.StringgetSQLForClustered()java.lang.StringgetSQLForReadOnly()java.lang.StringgetSQLForTableSpace()java.lang.String[]getSQLForTextSource(boolean withHeader)intgetTriggerIndex(java.lang.String name)TriggerDef[]getTriggers()java.lang.String[]getTriggerSQL()intgetType()ConstraintgetUniqueConstraintForIndex(Index index)Returns any unique Constraint using this indexConstraintgetUniqueOrPKConstraintForIndex(Index index)Returns any unique Constraint using this indexOrderedHashSetgetUniquePKConstraintNames()int[]getUpdatableColumns()booleanhasGeneratedColumn()booleanhasIdentityColumn()booleanhasLobColumn()voidinsertData(Session session, PersistentStore store, java.lang.Object[] data)For system operations outside transaction controlvoidinsertFromScript(Session session, PersistentStore store, java.lang.Object[] data)Not for general use.voidinsertNoCheckFromLog(Session session, java.lang.Object[] data)voidinsertSys(Session session, PersistentStore store, java.lang.Object[] data)Used by the system tables onlyintinsertSys(Session session, PersistentStore store, Result ins)Used for system table inserts.booleanisBestRowIdentifiersStrict()booleanisCached()booleanisConnected()booleanisDataReadOnly()booleanisDropped()booleanisFileBased()Text or Cached Tables are normally file basedbooleanisInsertable()booleanisQueryBased()booleanisReadOnly()booleanisSchemaBaseTable()booleanisTemp()booleanisText()booleanisTriggerDeletable()booleanisTriggerInsertable()booleanisTriggerUpdatable()booleanisUpdatable()booleanisView()booleanisWithDataSource()booleanisWritable()voidmaterialise(Session session)voidmaterialiseCorrelated(Session session)voidprepareTable()RowIteratorrowIteratorClustered(PersistentStore store)RowIteratorrowIteratorClustered(Session session)voidsetDataReadOnly(boolean value)voidsetGeneratedColumns(Session session, java.lang.Object[] data)voidsetIndexRoots(long[] roots)Sets the index roots of a cached/text table to specified file pointers.voidsetName(HsqlNameManager.HsqlName name)voidsystemSetIdentityColumn(Session session, java.lang.Object[] data)-
Methods inherited from class org.hsqldb.TableBase
createAndAddIndexStructure, createIndex, createPrimaryIndex, dropIndex, duplicate, getColumnCount, getColumnNotNull, getColumnTypes, getDataColumnCount, getEmptyRowData, getFullIndex, getIndex, getIndexCount, getIndexList, getNewColumnCheckList, getPersistenceId, getPrimaryIndex, getPrimaryKey, getPrimaryKeyTypes, getSpaceID, getTableType, hasPrimaryKey, isEmpty, isTransactional, onCommitPreserve, rowIterator, rowIterator, setBestRowIdentifiers, setIndexes, setSpaceID, setTransactional
-
-
-
-
Field Detail
-
emptyArray
public static final Table[] emptyArray
-
columnList
public HashMappedList columnList
-
-
Constructor Detail
-
Table
public Table(Database database, HsqlNameManager.HsqlName name, int type)
-
Table
public Table(Table table, HsqlNameManager.HsqlName name)
trigger transition table
-
-
Method Detail
-
getType
public int getType()
- Specified by:
getTypein interfaceSchemaObject
-
getName
public final HsqlNameManager.HsqlName getName()
Returns the HsqlName object fo the table- Specified by:
getNamein interfaceSchemaObject
-
getCatalogName
public HsqlNameManager.HsqlName getCatalogName()
Returns the catalog name or null, depending on a database property.- Specified by:
getCatalogNamein interfaceSchemaObject
-
getSchemaName
public HsqlNameManager.HsqlName getSchemaName()
Returns the schema name.- Specified by:
getSchemaNamein interfaceSchemaObject
-
getOwner
public Grantee getOwner()
- Specified by:
getOwnerin interfaceSchemaObject
-
getReferences
public OrderedHashSet getReferences()
- Specified by:
getReferencesin interfaceSchemaObject
-
getDefaultRanges
public RangeVariable[] getDefaultRanges()
-
getReferencesForDependents
public OrderedHashSet getReferencesForDependents()
-
getComponents
public OrderedHashSet getComponents()
- Specified by:
getComponentsin interfaceSchemaObject
-
compile
public void compile(Session session, SchemaObject parentObject)
- Specified by:
compilein interfaceSchemaObject
-
getSQL
public java.lang.String getSQL()
- Specified by:
getSQLin interfaceSchemaObject
-
getChangeTimestamp
public long getChangeTimestamp()
- Specified by:
getChangeTimestampin interfaceSchemaObject
-
setName
public final void setName(HsqlNameManager.HsqlName name)
-
getSQLForReadOnly
public java.lang.String getSQLForReadOnly()
-
getSQLForTextSource
public java.lang.String[] getSQLForTextSource(boolean withHeader)
-
getSQLForClustered
public java.lang.String getSQLForClustered()
-
getSQLForTableSpace
public java.lang.String getSQLForTableSpace()
-
getTriggerSQL
public java.lang.String[] getTriggerSQL()
-
getIndexRootsSQL
public java.lang.String getIndexRootsSQL(long[] roots)
-
getColumnListSQL
public java.lang.String getColumnListSQL(int[] col, int len)
-
getColumnListWithTypeSQL
public java.lang.String getColumnListWithTypeSQL()
-
isConnected
public boolean isConnected()
-
compareRows
public static int compareRows(Session session, java.lang.Object[] a, java.lang.Object[] b, int[] cols, Type[] coltypes)
compares two full table rows based on a set of columns- Parameters:
a- a full rowb- a full rowcols- array of column indexes to comparecoltypes- array of column types for the full row- Returns:
- comparison result, -1,0,+1
-
getId
public int getId()
Used to create row id's
-
isSchemaBaseTable
public final boolean isSchemaBaseTable()
-
isWithDataSource
public final boolean isWithDataSource()
-
isText
public final boolean isText()
-
isTemp
public final boolean isTemp()
-
isReadOnly
public final boolean isReadOnly()
-
isView
public final boolean isView()
-
isQueryBased
public boolean isQueryBased()
-
isCached
public boolean isCached()
-
isDataReadOnly
public boolean isDataReadOnly()
-
isDropped
public boolean isDropped()
-
checkDataReadOnly
public void checkDataReadOnly()
Used by INSERT, DELETE, UPDATE operations
-
setDataReadOnly
public void setDataReadOnly(boolean value)
-
isFileBased
public boolean isFileBased()
Text or Cached Tables are normally file based
-
addConstraint
public void addConstraint(Constraint c)
Adds a constraint.
-
getConstraints
public Constraint[] getConstraints()
Returns the list of constraints.
-
getFKConstraints
public Constraint[] getFKConstraints()
Returns the list of FK constraints.
-
getPrimaryConstraint
public Constraint getPrimaryConstraint()
Returns the primary constraint.
-
getUniqueOrPKConstraintForIndex
public Constraint getUniqueOrPKConstraintForIndex(Index index)
Returns any unique Constraint using this index- Parameters:
index-
-
addColumn
public void addColumn(ColumnSchema column)
Performs the table level checks and adds a column to the table at the DDL level. Only used at table creation, not at alter column.
-
addColumnNoCheck
public void addColumnNoCheck(ColumnSchema column)
-
hasGeneratedColumn
public boolean hasGeneratedColumn()
-
hasLobColumn
public boolean hasLobColumn()
-
hasIdentityColumn
public boolean hasIdentityColumn()
-
getNextIdentity
public long getNextIdentity()
-
getDependentExternalConstraints
public OrderedHashSet getDependentExternalConstraints()
-
getUniquePKConstraintNames
public OrderedHashSet getUniquePKConstraintNames()
-
getColumnIndex
public int getColumnIndex(java.lang.String name)
Returns the index of given column name or throws if not found
-
findColumn
public int findColumn(java.lang.String name)
Returns the index of given column name or -1 if not found.
-
getBestRowIdentifiers
public int[] getBestRowIdentifiers()
-
isBestRowIdentifiersStrict
public boolean isBestRowIdentifiersStrict()
-
getClusteredIndex
public Index getClusteredIndex()
-
createPrimaryKey
public void createPrimaryKey()
Shortcut for creating default PK's.
-
createPrimaryKey
public void createPrimaryKey(HsqlNameManager.HsqlName indexName, int[] columns, boolean columnsNotNull)
Creates a single or multi-column primary key and index. sets the colTypes array. Finalises the creation of the table. (fredt@users)
-
createPrimaryKeyConstraint
public void createPrimaryKeyConstraint(HsqlNameManager.HsqlName indexName, int[] columns, boolean columnsNotNull)
-
getColumn
public ColumnSchema getColumn(int i)
Returns the Column object at the given index
-
getColumnNameSet
public OrderedHashSet getColumnNameSet(int[] columnIndexes)
-
getColumnNameSet
public OrderedHashSet getColumnNameSet(boolean[] columnCheckList)
-
getColumnNames
public void getColumnNames(boolean[] columnCheckList, Set set)
-
getColumnNameSet
public OrderedHashSet getColumnNameSet()
-
getTriggerIndex
public int getTriggerIndex(java.lang.String name)
-
getConstraint
public Constraint getConstraint(java.lang.String constraintName)
return the named constriant
-
getUniqueConstraintForIndex
public Constraint getUniqueConstraintForIndex(Index index)
Returns any unique Constraint using this index- Parameters:
index-- Returns:
-
getTriggers
public TriggerDef[] getTriggers()
-
isWritable
public boolean isWritable()
-
isInsertable
public boolean isInsertable()
-
isUpdatable
public boolean isUpdatable()
-
isTriggerInsertable
public boolean isTriggerInsertable()
-
isTriggerUpdatable
public boolean isTriggerUpdatable()
-
isTriggerDeletable
public boolean isTriggerDeletable()
-
getUpdatableColumns
public int[] getUpdatableColumns()
-
getBaseTable
public Table getBaseTable()
-
getBaseTableColumnMap
public int[] getBaseTableColumnMap()
-
enforceRowConstraints
public void enforceRowConstraints(Session session, java.lang.Object[] data)
Enforce max field sizes according to SQL column definition. SQL92 13.8
-
enforceTypeLimits
public void enforceTypeLimits(Session session, java.lang.Object[] data)
-
getIndexRootsArray
public final long[] getIndexRootsArray()
Return the list of file pointers to root nodes for this table's indexes.
-
setIndexRoots
public void setIndexRoots(long[] roots)
Sets the index roots of a cached/text table to specified file pointers. If a file pointer is -1 then the particular index root is null. A null index root signifies an empty table. Accordingly, all index roots should be null or all should be a valid file pointer/reference.
-
insertNoCheckFromLog
public void insertNoCheckFromLog(Session session, java.lang.Object[] data)
-
insertSys
public int insertSys(Session session, PersistentStore store, Result ins)
Used for system table inserts. No checks. No identity columns.
-
insertFromScript
public void insertFromScript(Session session, PersistentStore store, java.lang.Object[] data)
Not for general use. Used by ScriptReader to unconditionally insert a row into the table when the .script file is read.
-
insertData
public void insertData(Session session, PersistentStore store, java.lang.Object[] data)
For system operations outside transaction control
-
insertSys
public void insertSys(Session session, PersistentStore store, java.lang.Object[] data)
Used by the system tables only
-
setGeneratedColumns
public void setGeneratedColumns(Session session, java.lang.Object[] data)
-
systemSetIdentityColumn
public void systemSetIdentityColumn(Session session, java.lang.Object[] data)
-
getDeleteRowFromLog
public Row getDeleteRowFromLog(Session session, java.lang.Object[] data)
For log statements. Find a single row to delete.
-
rowIteratorClustered
public RowIterator rowIteratorClustered(Session session)
-
rowIteratorClustered
public RowIterator rowIteratorClustered(PersistentStore store)
-
clearAllData
public void clearAllData(Session session)
- Overrides:
clearAllDatain classTableBase
-
clearAllData
public void clearAllData(PersistentStore store)
- Overrides:
clearAllDatain classTableBase
-
getRowStore
public PersistentStore getRowStore(Session session)
Path used for all stores- Overrides:
getRowStorein classTableBase
-
getQueryExpression
public QueryExpression getQueryExpression()
-
getDataExpression
public Expression getDataExpression()
-
prepareTable
public void prepareTable()
-
materialise
public void materialise(Session session)
-
materialiseCorrelated
public void materialiseCorrelated(Session session)
-
-
DataMelt 3.0 © DataMelt by jWork.ORG