org.h2.table

## Class RegularTable

- java.lang.Object
- - org.h2.engine.DbObjectBase
  - - org.h2.schema.SchemaObjectBase
    - - org.h2.table.Table
      - - org.h2.table.TableBase
        - - org.h2.table.RegularTable

All Implemented Interfaces:
  DbObject, SchemaObject

Direct Known Subclasses:
  MVTable, PageStoreTable

    public abstract class RegularTable
    extends TableBase

Most tables are an instance of this class. For this table, the data is stored in the database. The actual data is not kept here, instead it is kept in the indexes. There is at least one index, the scan index.

### Field Summary

Fields
`protected boolean` `containsLargeObject` Whether the table contains a CLOB or BLOB.
`protected Session` `lockExclusiveSession` The session (if any) that has exclusively locked this table.
`protected java.util.concurrent.ConcurrentHashMap<Session,Session>` `lockSharedSessions` The set of sessions (if any) that have a shared lock on the table.

### Fields inherited from class org.h2.table.Table

`columns, compareMode, isHidden, TYPE_CACHED, TYPE_MEMORY`

### Fields inherited from class org.h2.engine.DbObjectBase

`comment, database, trace`

### Fields inherited from interface org.h2.engine.DbObject

`AGGREGATE, COMMENT, CONSTANT, CONSTRAINT, DOMAIN, FUNCTION_ALIAS, INDEX, RIGHT, ROLE, SCHEMA, SEQUENCE, SETTING, SYNONYM, TABLE_OR_VIEW, TRIGGER, USER`

### Constructor Summary

Constructors
`protected` `RegularTable(CreateTableData data)`

### Method Summary

Methods
`protected static void` `addRowsToIndex(Session session, java.util.ArrayList<Row> list, Index index)` Appends the specified rows to the specified index.
`boolean` `canDrop()` Check if this table can be dropped.
`boolean` `canGetRowCount()` Check if the row count can be retrieved quickly.
`boolean` `canTruncate()` Check if this table can be truncated.
`java.util.ArrayList<Session>` `checkDeadlock(Session session, Session clash, java.util.Set<Session> visited)` Check if a deadlock occurred.
`void` `checkRename()` Check if this object can be renamed.
`void` `checkSupportAlter()` Check if this table supports ALTER TABLE.
`boolean` `getContainsLargeObject()`
`protected static java.lang.String` `getDeadlockDetails(java.util.ArrayList<Session> sessions, boolean exclusive)` Formats details of a deadlock.
`Column` `getRowIdColumn()` Get the row id column if this table has one.
`TableType` `getTableType()` Get the table type name
`boolean` `isDeterministic()` Check if the table is deterministic.
`boolean` `isLockedExclusively()` Check if this table is locked exclusively.
`boolean` `isLockedExclusivelyBy(Session session)` Check if the table is exclusively locked by this session.
`protected static void` `sortRows(java.util.ArrayList<? extends SearchRow> list, Index index)` Sorts the specified list of rows for a specified index.
`java.lang.String` `toString()`

### Methods inherited from class org.h2.table.TableBase

`getCreateSQL, getDropSQL, getMainIndexColumn, isGlobalTemporary`

### Methods inherited from class org.h2.table.Table

`addConstraint, addDependencies, addDependentView, addIndex, addRow, addSequence, addSynonym, addTrigger, canReference, checkWritingAllowed, close, compareValues, createRow, doesColumnExist, dropMultipleColumnsConstraintsAndIndexes, findColumn, findPrimaryKey, fire, fireAfterRow, fireBeforeRow, fireRow, getBestPlanItem, getCheckForeignKeyConstraints, getChildren, getColumn, getColumn, getColumn, getColumns, getCompareMode, getConstraints, getCreateSQLForCopy, getDefaultValue, getDependentViews, getDiskSpaceUsed, getIndex, getIndexes, getIndexForColumn, getMaxDataModificationId, getOnCommitDrop, getOnCommitTruncate, getOnUpdateValue, getPrimaryKey, getRow, getRowCount, getRowCountApproximation, getScanIndex, getScanIndex, getTemplateRow, getTemplateSimpleRow, getType, getUniqueIndex, hasInsteadOfTrigger, hasSelectTrigger, isHidden, isMVStore, isPersistData, isPersistIndexes, isQueryComparable, isTableExpression, isView, lock, lockRow, removeChildrenAndResources, removeColumnExpressionsDependencies, removeConstraint, removeDependentView, removeIndex, removeIndexOrTransferOwnership, removeRow, removeSequence, removeSynonym, removeTrigger, rename, renameColumn, setCheckForeignKeyConstraints, setColumns, setHidden, setOnCommitDrop, setOnCommitTruncate, setTableExpression, truncate, unlock, updateRow, updateRows, validateConvertUpdateSequence`

### Methods inherited from class org.h2.schema.SchemaObjectBase

`getSchema, getSQL, getSQL`

### Methods inherited from class org.h2.engine.DbObjectBase

`getComment, getDatabase, getId, getModificationId, getName, invalidate, isTemporary, isValid, setComment, setModified, setObjectName, setTemporary`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

### Methods inherited from interface org.h2.engine.DbObject

`getComment, getDatabase, getId, getName, isTemporary, setComment, setTemporary`

### Field Detail

#### containsLargeObject

    protected final boolean containsLargeObject

Whether the table contains a CLOB or BLOB.

#### lockExclusiveSession

    protected volatile Session lockExclusiveSession

The session (if any) that has exclusively locked this table.

#### lockSharedSessions

    protected final java.util.concurrent.ConcurrentHashMap<Session,Session> lockSharedSessions

The set of sessions (if any) that have a shared lock on the table. Here we are using using a ConcurrentHashMap as a set, as there is no ConcurrentHashSet.

### Constructor Detail

#### RegularTable

    protected RegularTable(CreateTableData data)

### Method Detail

#### addRowsToIndex

    protected static void addRowsToIndex(Session session,
                      java.util.ArrayList<Row> list,
                      Index index)

Appends the specified rows to the specified index.

Parameters:
  `session` - the session
  `list` - the rows, list is cleared on completion
  `index` - the index to append to

#### getDeadlockDetails

    protected static java.lang.String getDeadlockDetails(java.util.ArrayList<Session> sessions,
                                      boolean exclusive)

Formats details of a deadlock.

Parameters:
  `sessions` - the list of sessions
  `exclusive` - true if waiting for exclusive lock, false otherwise
Returns:
  formatted details of a deadlock

#### sortRows

    protected static void sortRows(java.util.ArrayList<? extends SearchRow> list,
                Index index)

Sorts the specified list of rows for a specified index.

Parameters:
  `list` - the list of rows
  `index` - the index to sort for

#### canDrop

    public boolean canDrop()

Description copied from class: `Table`
Check if this table can be dropped.

Specified by:
  `canDrop` in class `Table`
Returns:
  true if it can

#### canGetRowCount

    public boolean canGetRowCount()

Description copied from class: `Table`
Check if the row count can be retrieved quickly.

Specified by:
  `canGetRowCount` in class `Table`
Returns:
  true if it can

#### canTruncate

    public boolean canTruncate()

Description copied from class: `Table`
Check if this table can be truncated.

Overrides:
  `canTruncate` in class `Table`
Returns:
  true if it can

#### checkDeadlock

    public java.util.ArrayList<Session> checkDeadlock(Session session,
                                             Session clash,
                                             java.util.Set<Session> visited)

Description copied from class: `Table`
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.

Overrides:
  `checkDeadlock` in class `Table`
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

#### checkRename

    public void checkRename()

Description copied from class: `DbObjectBase`
Check if this object can be renamed. System objects may not be renamed.

Specified by:
  `checkRename` in interface `DbObject`
Specified by:
  `checkRename` in class `DbObjectBase`

#### checkSupportAlter

    public void checkSupportAlter()

Description copied from class: `Table`
Check if this table supports ALTER TABLE.

Specified by:
  `checkSupportAlter` in class `Table`

#### getContainsLargeObject

    public boolean getContainsLargeObject()

#### getRowIdColumn

    public Column getRowIdColumn()

Description copied from class: `Table`
Get the row id column if this table has one.

Overrides:
  `getRowIdColumn` in class `Table`
Returns:
  the row id column, or null

#### getTableType

    public TableType getTableType()

Description copied from class: `Table`
Get the table type name

Specified by:
  `getTableType` in class `Table`
Returns:
  the table type name

#### isDeterministic

    public boolean isDeterministic()

Description copied from class: `Table`
Check if the table is deterministic.

Specified by:
  `isDeterministic` in class `Table`
Returns:
  true if it is

#### isLockedExclusively

    public boolean isLockedExclusively()

Description copied from class: `Table`
Check if this table is locked exclusively.

Specified by:
  `isLockedExclusively` in class `Table`
Returns:
  true if it is.

#### isLockedExclusivelyBy

    public boolean isLockedExclusivelyBy(Session session)

Description copied from class: `Table`
Check if the table is exclusively locked by this session.

Overrides:
  `isLockedExclusivelyBy` in class `Table`
Parameters:
  `session` - the session
Returns:
  true if it is

#### toString

    public java.lang.String toString()

Overrides:
  `toString` in class `DbObjectBase`